Alex
Alex

Reputation: 21

.htaccess 301 redirecting folder to absolute url?

Hey I'm just setting up a few 301 redirects but I can't work out how to do this particular function.

I have a ton of pages on my existing site e.g.

/products/23
/products/3
/products/57
/products/36
..etc

That I all want to point to one page on a new domain .e.g.
http://www.mynewdomain.com/store

I've tried a few RewriteRules with no success!

Thanks for any help !

Upvotes: 2

Views: 1675

Answers (1)

Paolo Stefan
Paolo Stefan

Reputation: 10263

It should work with a RedirectMatch directive (although you don't specify in your question how to pass the product codes to the new page):

RedirectMatch301 ^/products/(.*) http://www.mynewdomain.com/store/$1

This rule will redirect /products/NNN to http://www.mynewdomain.com/store/NNN (with HTTP status code 301).

Upvotes: 2

Related Questions