简体   繁体   中英

Zend framework, add index controller and index action names to URL

I need to add the index controller name and the index action name in the url for example:

application.local will display the application.local/index/index (index controller, index action) In the url I need to display the full path: application.local/index/index

and

application.local/pages will display application.local/pages/index -I need to display the full path in the url: application.local/pages/index

It's like a 301 redirect, but I want to know if there is a possibility to do this form the framework and not form htaccess

One way to address this would be inspecting the URL (ie $request->getServer('REQUEST_URI') ) and the dispatched controller and action ( $request->getControllerName() , $request->getActionName() ) to see if your criteria for redirecting are met. If so - do a redirect.

A good place to put this logic would be a FrontController plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM