remove a specific part from url with htaccess and redirect

Advertisements

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

>Solution :

You need the rewrite module of Apache: mod_rewrite.

Then in your htaccess this:

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

Leave a ReplyCancel reply