Forum Moderators: phranque

Message Too Old, No Replies

htaccess and FrontPage/Expressions 09

htaccess issues with Frontpage.

         

mofolo

11:19 pm on Oct 11, 2009 (gmt 0)

10+ Year Member



Hey,

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?

jdMorgan

11:53 pm on Oct 11, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you allow the request with either trailing slash or no trailing slash, you create two bad problems:

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