0

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,

1

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]
  • Thanks, that worked, but now in every url I receive the 404, is it normal? I did clean the cache, but didn't reindex yet, because I have a lot of products and reindex will take ages. Sorry for the stupid question. – Artur Rain Nov 2 '15 at 15:23
  • Hello, I've reindexed all the website and still getting 404 error on the affected pages, any suggestions? Thank you – Artur Rain Nov 3 '15 at 8:06
0

The best way to do this (simple, but not very fast method) is to export the table of core_url_rewrites and the change in bulk and re-upload the changes.

I hope this answer will set you on the right track :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.