Zend Basic Tutorial
Zend Forms
Zend Database
Zend Advanced
A Literal
route matches exact URLs exactly as defined — no variables, no wildcards.
You want to match a fixed path like /about
, /contact
, /login
, etc.
Add this inside
use Application\Controller\MainController; 'router' => [ 'routes' => [ 'about' => [ 'type' => \Laminas\Router\Http\Literal::class, 'options' => [ 'route' => '/about', 'defaults' => [ 'controller' => MainController::class, 'action' => 'about', ], ], ], ], ],
namespace Application\Controller; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\View\Model\ViewModel; class MainController extends AbstractActionController { public function aboutAction() { return new ViewModel(); } }
<h2>About Page</h2> <p>This is the static About page.</p>
http://localhost:8080/about