|
|||
|
Hi
I'm currently starting to work with zf, but I've a big problem, that needs to be solved before I go on. zf does not care about the trailing slash in urls, but it is a no go, if you want to go for seo. An example: GET /index/action HTTP/1.1 is not the same as GET /index/action/ HTTP/1.1 If you have not spotted the difference, one has a trailing forward slash ‘/’ in the URI and one does not. For one is requesting the content of object ‘action’ under directory ‘/index/’, and another one is requesting the content of the index file under directory ‘/index/action/’. Although many of us would usually ignore the trailing slash, and write out the URL without it, web servers usually will correct this behaviour by replying a 301 permanent redirect to an URL with the trailing slash, if ‘action’ is indeed a directory. Here is a point out of “Quality Guidelines - Specific recommendations” by Google: Don’t create multiple pages, subdomains, or domains with substantially duplicate content. But that is done as zf doesn't care about it. So is there a way to get zf only accept urls with a trailing slash and throw a 404 or 301 if it does not? thx |
|
||||
|
This an issue of Canonical URLs: (SEO advice: url canonicalization).
You can get a long way by just ensuring that all your links use the trailing slash in your code (href's and the like). To further correct this (such as when users link to you using URLs with out the trailing slash), play with your rewrite rules in .htaccess, to always add it the slash if it doesn't exist.
__________________
- xentek |
|
|||
|
Hi xentek,
thank you for your answer! I got the same problem having more problems with it ![]() Quote:
Therefore I configured my route test: "/test/" and tried to insert it inside my template using $this->url(array(...), 'test'). Unfortunately the helper destroyed everything and added the link without trailing slash As you can see, I failed ensuring that all my links use the trailing slash in my code. Any ideas? Thanks in advance! Philipp edit: This issue is tracked in the Zend Issue Tracking System: [#ZF-3807] URL assembly should include a trailing slash - Zend Framework Issue Tracker. Please vote for it ![]() Even when it's tracked there: Does anybody here know a workaround? Last edited by Philipp : 10-12-2008 at 08:59 PM. |
![]() |
| Thread Tools | |
| Display Modes | |
|
|