.htaccess - how to redirect all URLs to a different URL? -
e.g
i have urls this, domain/buy-now/product title/productid
http://www.mydomain.com/buy-now/this-is-the-product-one/order/1234
considering online shop contains alot of products different product title , product id right? how going redirect "all urls format", "this new url" via htaccess ?
http://www.mydomain.com/buy-now/order/this-is-the-product/1234
the difference is, word "order" got transferred beside "buy-now"
try adding these rules htaccess file in document root:
rewriteengine on rewriterule ^buy-now/([^/]+)/order/([0-9]+)$ /buy-now/order/$1/$2 [l,r=301]
you can remove =301
square brackets if don't want permanent redirect. if you'd rather use htaccess file in /buy-now
directory:
rewriteengine on rewritebase /buy-now/ rewriterule ^([^/]+)/order/([0-9]+)$ order/$1/$2 [l,r=301]
Comments
Post a Comment