Rewrite query string in .htaccess

I am trying to make a very simple correspondence of the query string and I have 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 I wrote in my .htaccess file and it gives me an internal server error. I am really new to this mod recycling business, so any help would be greatly appreciated.

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

+4
source share
1 answer

If you just want it to take the php file without telling 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 conical 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 may prefer the script alias:

 ScriptAliasMatch ^(.*)\?(.*)$ index.php 
+4
source

All Articles