views:

32

answers:

2

Hey all, I'm having all kinds of problems with a bunch of apache redirects just now and could really use some help!

I'm wating to put in a 301 redirect for a load of urls from a client's old site to their new site in the following format;

Old - page.php?pageNum_rs_all=0&totalRows_rs_all=112
New - page/sub?foo=bar

The values in the query sting for the old site don't in any way tie up to any ids or references on the new site, I only want to match that specific request and redirect to the new page.

It feels like I've tried just about every combination of rewriterule I can find online but still nothing seems to be working. This is running on Apache 2.2.

The rule I started with (and keep going back to) is;

RewriteRule ^/page.php\?pageNum_rs_all=0&totalRows_rs_all=112 /page/sub?foo=bar [R=301,L,NE]

Any help would be greatly appreciated!

c.

A: 

The reason that this doesn't work is that RewriteRule can't see the QueryString. To get at the Query String, you need to use RewriteCond. See http://wiki.apache.org/httpd/RewriteQueryString for examples of how this works.

Rich Bowen
Cheers rich, I'd looked at the briefly before but hadn't fully garsped it, tried it now and it's working ok, now to go make all the other 300+ work!
Colin
A: 

I've always tended to use use a series of 301 redirects in the following manner

Redirect 301 /oldpage /newpage
WeeJames