1

I've got:

Redirect 301 /blog/?p=1 http://www.new-site.com/blog/2000/10/myslug/

which works fine, unless followed by:

RedirectMatch 301 ^/blog(/)?(.*)$ http://www.new-site.com/blog/$2

I've tried all kinds of versions, including RewriteRule, but nothing has worked. How do I keep the first specific rule, and write an "everything else keeps its request uri and query string" rule?

Thanks

beej
  • 135
  • 1
  • 9
  • Please post your .htaccess file. It's likely caused by the order in which it's written, which is like an order of operations. – stslavik Sep 06 '11 at 17:27
  • If these are the only two lines in the htaccess file, it still doesn't work, but just the first line works great! – beej Sep 06 '11 at 17:55

1 Answers1

0

Alright, assuming these are the only two lines, what I see is this:

Redirect 301 /blog/?p=1 http://www.new-site.com/blog/2000/10/myslug/

RedirectMatch 301 ^/blog(/)?(.*)$ http://www.new-site.com/blog/$2

These are basically saying the same thing, that is, on a match, permanently redirect all blog queries to the new site.

With the second one you're saying match from the beginning the string /blog with a possible slash, which you'll capture, and possibly more information, which you'll also capture, then just put all that information into blog/extra-picked-up-info. This may be part of the problem, or you may be able to get around it by reordering the directives, and seeing if the lower directive receives precedence.

RedirectMatch 301 /blog(?:/\?)?(.*)?$ http://www.new-site.com/blog/$1
Redirect 301 /blog/?p=1 http://www.new-site.com/blog/2000/10/myslug/

Otherwise, you're going to need to reexamine your URIs, and find something more uniquely identifying.

stslavik
  • 2,920
  • 2
  • 19
  • 31