Forum Moderators: phranque
I'm using a re-write condition in my htaccess:
RewriteRule ^(.*)/$ $1.php [L]
[Basically means: When address bar goes to /google/ it's really accessing google.php]
Works perfectly and Frontpage continues to work fine.
But when I add this condition:
RewriteRule ^(.*)(/?)$ $1.php [L]
[So if the user enters /google/ OR /google (without ending slash) it'll access google.php]
Frontpage can no longer connect to the website..
Any ideas?
1) Your rule becomes an infinite loop, because xyz gets rewritten to xyz.php which in turn gets rewritten to xyz.php.php, which then gets rewritten to xyz.php.php.php etc., until the server gives up and throws an "internal redirection limit" error, and
2) You create duplicate content, because the same 'page' content will be reachable at either example.com/xyz or example.com/xyz/
Search engines don't treat that situation kindly.
The correct solution is to pick either example.com/xyz or example.com/xyz/ as the correct (canonical) form for your URLs, use only the correct form in links within your own site, and permanently redirect any requests for the incorrect form to the correct form using a separate rewriterule.
If the 'things' being requested are 'pages' and not 'directories', then you should not use a trailing slash on the URL.
Jim