Forum Moderators: phranque
http*//www.foo.com/main/index.php?a=foo1/foo2/foo3/foo4/…
to be a 301 to
http*//www.foo.com/main/foo4/…
We tried these 3 directives in .htaccess after reading through many threads but with no luck so far:
1)
redirect 301 /main/index.php?a=foo1/foo2/foo3/foo4 http*//www.foo.com/main/foo4/
2)
Options +FollowSymLinks
rewriteEngine on
RewriteCond %{QUERY_STRING} ^ a=foo1/foo2/foo3/foo4$
RewriteRule ^index\.php$ http*//www.foo.com/main/foo4/ [R=301,L]
3)
Options +FollowSymLinks
rewriteEngine on
rewriteBase /main/index.php?a=foo1/foo2/foo3/foo4
rewriteRule ^(.+) http*//www.foo.com/main/foo4$1 [L,R=301]
Any suggestions where we’re doing something wrong?
RewriteCond %{QUERY_STRING} ^foo1/foo2/foo3/foo4$
RewriteRule ^.*$ http*//www.foo.com/main/foo4/ [R=301,L]
You could also use {THE_REQUEST} which will examine the full original request for the url you are rewriting... it would look something like this:
RewriteCond %{THE_REQUEST} ^/index\.php\?a=foo1/foo2/foo3/foo4$
RewriteRule ^.*$ http*//www.foo.com/main/foo4/ [R=301,L]
Hope this helps.
Justin