i am experiencing a very unique problem and i hope someone can help!
so we have recently created a new ecommerce website and we made it live and everything was working great but when we to implement our 301's from our old pages we were getting some wierd things
so the code below actually works
Redirect 301 /directory/ http://mysite.com/index.php?cat=1
this code does not
Redirect 301 /directory/sub_directory/ http://mysite.com/index.php?cat=2
the output when i try to do this redirection is "Invalid parameters specified!" on a blank webpage and in the address bar it has this
we were thinking that maybe the problem is because our old pages were dynamic but mod_rewrite was used to create more readable urls and we have also deleted all our old files because they were interfering with our new pages rendering
any help would be greatly appreciated!
That is strange, as redirect should only match the specific url listed, where as it looks like its behaving like rewriterule and partially matching the subdirectory url against the first rule..
try putting the more specific rule above the less specific, like so:
Redirect 301 /directory/sub_directory/ http://mysite.com/index.php?cat=2 Redirect 301 /directory/ http://mysite.com/index.php?cat=1
That way the more specific rule will be hit first, and the /directory/ only rule will only match if more specific matches above fail
alternatively, you could try RewriteRules:
RewriteRule ^directory/$ http://mysite.com/index.php?cat=1 [R=301,NC,L] RewriteRule ^directory/sub_directory/$ http://mysite.com/index.php?cat=2 [R=301,NC,L]
the ^ and $ anchors should prevent any unwanted partial matching