Home > Enterprise >  remove a specific part from url with htaccess and redirect
remove a specific part from url with htaccess and redirect

Time:08-31

I was using translatepress on my wordpress site so my site urls were like dynamiclinic.com/en-ae/hair-transplant but now I have removed translatepress so now my urls are like dynamiclinic.com/hair-transplant but I have submitted urls for SEO with en-ae slug. I want that if en-ae is present in any URL then it gets removed automatically and gets redirected to page without en-ae. For 1 example dynamiclinic.com/en-ae/hair-transplant redirects to dynamiclinic.com/hair-transplant

CodePudding user response:

You need the rewrite module of Apache: mod_rewrite.

Then in your htaccess this:

RewriteEngine on 
RewriteRule ^en-ae/(.*)$ $1
  • Related