mod_rewrite to change my urls

Posted by user319859 on Stack Overflow See other posts from Stack Overflow or by user319859
Published on 2010-04-18T20:42:15Z Indexed on 2010/04/19 5:03 UTC
Read the original article Hit count: 216

Filed under:
|

Hi,

I've been fighting with mod-rewrite for a while.

Basically, I have a website that I'm moving to a difference namespace/directory.

What I'd like to do is change urls that look like this:

http://mydomain.com/index.php?a=xxxxxxxxxx

These urls will always have "index.php?a=". I have a different/new site that also has an index.php file, so it's important that I do a rewrite only when a= is in the URL.

The new url should be like

http://mydomain.com/ns1/index.php?a=xxxxxxxxxxx

Seems pretty simple, but i can't seem to get mod_rewrite to do it for me, here's what I have:

# rewrite old urls to new namespace
RewriteRule ^/index.php\?a=(.*)$ /gc1/index.php\?x=1&a=$1 [R=301,L]

See anything wrong?

© Stack Overflow or respective owner

Related posts about apache

Related posts about mod-rewrite