drath Posted January 10, 2010 Share Posted January 10, 2010 I'm trying to change the following: http://www.sitename.com/page.php?id=pagename http://www.sitename.com/page.php?id=otherpagename to: http://www.sitename.com/pagename.php http://www.sitename.com/otherpagename.php I tried the following: RewriteRule ^/(.*)\.php$ /page.php?id=$1 (no effect) RewriteRule ^(.*)\.php$ /page.php?id=$1 (500/404) Anybody see my error(s)? Quote Link to comment https://forums.phpfreaks.com/topic/187905-rewrite-help/ Share on other sites More sharing options...
corbin Posted January 10, 2010 Share Posted January 10, 2010 The problem is that it's looping infinitely. RewriteRule ^(.*)\.php$ /page.php?id=$1 (500/404) With RewriteRule, only the page name is compared, not the query string too (in other words, only /path/page.php, not /path/page.php?blah=bleh). AS such, RewriteRule ^(.*)\.php$ matches page.php.... So, it goes into an infinite loop. Try something like: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\.php$ /page.php?id=$1 Quote Link to comment https://forums.phpfreaks.com/topic/187905-rewrite-help/#findComment-992218 Share on other sites More sharing options...
drath Posted January 10, 2010 Author Share Posted January 10, 2010 Thank you kindly. I think I got a handle on this stuff now. Quote Link to comment https://forums.phpfreaks.com/topic/187905-rewrite-help/#findComment-992234 Share on other sites More sharing options...
corbin Posted January 10, 2010 Share Posted January 10, 2010 No problem ;p. Quote Link to comment https://forums.phpfreaks.com/topic/187905-rewrite-help/#findComment-992348 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.