JD* Posted January 16, 2011 Share Posted January 16, 2011 Hey everyone, mod_rewrite is definitely something I am very weak with, so I'm hoping someone here can help me. What I'm trying to do on my test site (test.site.com:81) is rewrite anything with a ?, so http://test.site.com:81/?latest should rewrite to http://test.site.com:81/index.php?action=latest I thought I had it working, but I don't get the correct rewrite and now I'm seeing error in my log for my /javascript directory, my /includes, my /images, etc, so I'm not sure if it's my programming or if it's my rewrite. here is my current rewrite code: RewriteEngine On RewriteRule ^\?([^/]*)$ /index.php?action=$1 [L] Any help would be greatly appreciated Link to comment https://forums.phpfreaks.com/topic/224569-help-with-rewriting-while-ignoring-certain-urls/ Share on other sites More sharing options...
requinix Posted January 16, 2011 Share Posted January 16, 2011 RewriteRule doesn't look at the ? (or anything after). It only cares about the filename. You have to check the QUERY_STRING if you need it. RewriteCond %{QUERY_STRING} ^(latest|other verbs)$ RewriteRule ^/?$ index.php?action=%1 [L] Link to comment https://forums.phpfreaks.com/topic/224569-help-with-rewriting-while-ignoring-certain-urls/#findComment-1160040 Share on other sites More sharing options...
JD* Posted January 16, 2011 Author Share Posted January 16, 2011 A+, thanks a bunch! Link to comment https://forums.phpfreaks.com/topic/224569-help-with-rewriting-while-ignoring-certain-urls/#findComment-1160044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.