How to Remove Specific Words from URL Using .htaccess

.htaccesscategoryfrontendurl-rewrite

I'm trying to rewrite and remove some words from the URL using .htaccess.

I have en url like this:

http://example.com/es/ropita-de-bebe/chica/vestidos.html/

and I want to leave it like this:

http://example.com/es/ropita-de-bebe/vestidos.html/

I'm not very familiar with .htaccess rewrites,

Can someone help me.

UPDATE
I didn't find the working solution using the .htaccees, in general the answer worked (did change the url's), but as a result, all the pages showed 404.

Thanks,

Best Answer

To remove 'chica' from the url

RewriteRule ^(.*)-chica-(.*).html$ http://%{SERVER_NAME}/$1-$2.html [NC,R=301,L]

To remove 'chica' from the url http://example.com/es/ropita-de-bebe/chica/vestidos.html

RewriteRule ^chica/(.*)\.html$ $1-vestidos.html [L,R=301]

To remove 'chica' from the url http://example.com/es/ropita-de-bebe/chica/vestidos.html

RewriteRule ^(.*)/chica/(.*).html$ http://%{SERVER_NAME}/$1/$2.html [NC,R=301,L]
Related Topic