1

I want these URL redirects / forwards:

here.com/foo    ==> there.com/a/b
here.com/foobar ==> there.com/c/d

I have these two .htaccess RewriteRule lines:

RewriteRule ^foo$    http://there.com/a/b [R=301,L] 
RewriteRule ^foobar$ http://there.com/c/d [R=301,L]

But the result is:

here.com/foo    ==> there.com/a/b
here.com/foobar ==> there.com/a/b

foo is also matching foobar How do I make it work?

Rob Bednark
  • 25,981
  • 23
  • 80
  • 125

1 Answers1

1

This was a browser caching issue. I initially had the rules wrong. I changed the rules to those listed above, but because I'm using HTTP status code 301 (Moved Permanently), the browser was caching it and not getting the new request from the server. I tried a Chrome Incognito Window and discovered the issue.

Note that setting the HTTP status code to 303 (See Other) causes the browser not to cache it.

Rob Bednark
  • 25,981
  • 23
  • 80
  • 125
  • 2
    See this post for more advice: http://stackoverflow.com/questions/9153262/tips-for-debugging-htaccess-rewrite-rules#9204355 – TerryE Jul 06 '12 at 12:21
  • Wow, lots of excellent tips debugging .htaccess rewrite rules in that post. Thanks TerryE! – Rob Bednark Jul 09 '12 at 14:00