ZF2-259: Trailing slashes - Page Not Found Error

Issue Type: Bug Created: 2012-04-10T22:01:19.000+0000 Last Updated: 2012-04-11T06:50:45.000+0000 Status: Resolved Fix version(s): Reporter: Gilberto Albino (gilbertoalbino) Assignee: Ben Scholzen (dasprid) Tags: - Zend\Mvc\Router

  • slash
  • trailing
  • url

Related issues: Attachments:


I was testing the new Akrabat tutorial on ZF2 and got to this URL: http://zf2.localhost/album/add/ which causes the Page Not Found Error!

So, I removed the traing slash and the page was found...

I think it a critical bug...


Posted by Ben Scholzen (dasprid) on 2012-04-10T22:07:53.000+0000

This is not a bug, nor is it critical. URLs are to be specified explicitly. If you want to allow both variants, you could either use e.g. mod_rewrite to rewrite trailing-slash URLs to those with no trailing slashes, or write a listener which removes the trailing slash from the request (which I personally don't advise due to duplicate content).

Posted by Gilberto Albino (gilbertoalbino) on 2012-04-11T03:21:38.000+0000

Not a bug? Why ZF1 does its job with and without trailing slash? I've used the same htaccess file for both ZF1 and ZF2 and it just happened to ZF2 not being able to find the page.

Posted by Maks 3w (maks3w) on 2012-04-11T06:50:45.000+0000

IMO If the route refer to an action page then it should not have trailing slash, but if you think than this behavior is wrong you are free to open a discussion in the mailing list (zf-contributor)

IMO When you find a trailing slash you expects find more child pages like /album/add/XXXXX

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.