Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite help

Unexpected client redirect

         

tresmom5

6:57 pm on Apr 10, 2008 (gmt 0)

10+ Year Member



I am using this code for a content management system I'm thinking of using, but want to change the urls.

ErrorDocument 401 /401.html
ErrorDocument 403 /401.html
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

When I put that in the url changes from mysite.com/index.php?page.html to mysite.com/?/page.html. What do I need to do with this code to get it to be mysite.com/page.html without the ?.

[edited by: jdMorgan at 8:29 pm (utc) on April 10, 2008]
[edit reason] Code formatting [/edit]

jdMorgan

8:34 pm on Apr 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The fact that the "URL changes" means that some other code --in this or another .htaccess file or in your script-- is generating an external redirect. The code you posted --by itself-- does not do an external redirect. All it does is an internal rewrite, which does not change the browser's address bar.

You can watch the redirect by using the "Live HTTP Headers" add-on for Firefox and Mozilla-based browsers to find out if it is a 301 or 302 redirect. This might be handy to know while tracking down the problem.

Jim