infomf
infomf

Reputation: 167

.htaccess rewrite url with 2 elements to 1 elemnt

I have a URL with 2 parameters /manufacturer/product.html and I need to redirect to the URL without "manufacturer", ie. /product.html

RewriteRule ^\/manufacturer\/(.*)$ \/$1 [L]

This does not work.

can you help me?

Upvotes: 0

Views: 38

Answers (1)

ad08
ad08

Reputation: 2612

Here is the code that will work for you, make sure you paste this in your root .htaccess file. (rename the current .htaccess file to .htaccess.bak and paste the below code in a new .htaccess file in root directory)

RewriteEngine on
RewriteRule ^manufacturer/product\.html$ /product.html? [L,R]

When everything works as it should, you may replace R with R=301 (permanent redirect).

Upvotes: 1

Related Questions