Forum Moderators: phranque

Message Too Old, No Replies

Problem with mod rewrite

         

flycast

1:52 am on Mar 14, 2007 (gmt 0)

10+ Year Member



I am trying to server the index page when any other page is asked for:

/test.php
/anotherdirectory/index.php

but server the index page when it is asked for itself.

I have:
(.*)(^index\.php) /index.php

I get
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

when I ask for index.php and

page not found when I ask for test.php.

Any help? I am not very good at regex.

jdMorgan

3:14 pm on Mar 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




# Rewrite all php pages except index.php to index.php
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteRule ^[^.]+\.php$ /index.php [L]

Be aware that doing so is not a very good idea... Among other things, this creates duplicate-content issues, where all .php URLs will be seen to have the same content, and you may expect search engine ranking problems to result.

Jim