Jump to content

Help with rewriting while ignoring certain urls


JD*

Recommended Posts

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

 

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]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.