views:

22

answers:

1

I'm trying to do a very simple rewrite of a query string and I'm having no luck at all. I need to go from

http:// example dot com/?ACT=jquery

to

http:// example dot com/index.php?ACT=jquery

This is the code that I've written in my .htaccess file and it throws me an internal server error. I'm really new at this whole mod rewrite business so any help would be greatly appreciated.

RewriteEngine On
RewriteCond %{query_string} ^(ACT=jquery)$
RewriteRule ^(.*)$ index.php/?ACT=jquery

A: 

If you just want it to pick up the php file without informing the browser:

RewriteEngine On
RewriteRule ^/\?ACT=jquery$ index.php/?ACT=jquery [PT,L]

If you want the browser to change bookmarks etc. to create a cononical URL:

RewriteEngine On
RewriteRule ^/\?ACT=jquery$ index.php/?ACT=jquery [R=301,L]

Assuming arbitrary arguments:

RewriteEngine On
RewriteRule ^/\?(.*)$ index.php/?$1 [PT,L]

Or you might prefer a script alias:

ScriptAliasMatch ^(.*)\?(.*)$ index.php
bbadour