views:

28

answers:

2

Hi all,

I'm trying to redirect all URLs that start with "/?page=" to "/stuff/?page="

I have this in my .htaccess file:

RewriteEngine on 
RedirectMatch 301 ^/?page=/(.*)$ http://www.mysite.com/stuff/$1

But it's not working.. What am I doing wrong?

A: 

Try this

RewriteRule ^/stuff/?page=$ /?page=/

Remember, you're effectively turning the right (of the space) into the left.

Tim
A: 

The directives of mod_alias (one of them is RedirectMatch) do only work on the URI path and not the query. If you want to inspect the query, use mod_rewrite instead:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^page=
RewriteRule ^$ /stuff/ [L,R=301]
Gumbo