Reputation: 2660
I recently converted a wordpress webshop to a magento webshop. Now i want all the old urls that are indexed by the search engines redirect to the new ones from magento. Since it were only about 150 products i thought i'd do it manually.
This is what i tried for all the products :
Redirect 301 /products-page/accu/unibat-ctz5s-bs/ http://www.domain.nl/accu-s/unibat-ctz5s-bs.html
It does try to redirect, but it ends up at this URL : http://www.domain.nl/accu-s.htmlunibat-ctz5s-bs/ , which gives a 404 :(
Could anyone help me out here?
Upvotes: 0
Views: 463
Reputation: 143906
It sounds like your mod_rewrite rules at the end of your htaccess is interferring with your mod_alias directives (the Redirect
statements). In this case, you need to do the redirect, then jump out of the URL/file mapping pipeline and since both mod_rewrite and mod_alias get to do their thing in the pipeline, they both mangle the URI. Just stick with mod_rewrite, change all of your statements to:
RewriteRule ^/?products-page/accu/unibat-ctz5s-bs/$ http://www.domain.nl/accu-s/unibat-ctz5s-bs.html [L,R=301]
These need to go before any of your other rules. But also keep in mind, the way the Redirect
statement works vs redirecting using RewriteRule
. The Rewrite
"links" 2 URI-path nodes together. So something like:
Redirect 301 /foo http://www.domain.nl/bar
Would link /foo
and /bar
together, thus a request for /foo/blah/blah.html
would redirect to http://www.domain.nl/bar/blah/blah.html
. In order to translate this functionality to a rewrite rule you'd need:
RewriteRule ^/?foo(.*)$ http://www.domain.nl/bar$1 [L,R=301]
Upvotes: 1