Home > Blockchain >  Redirect Rule htaccess WordPress
Redirect Rule htaccess WordPress

Time:02-18

Hi I want to redirect URLs from /search/label/anything to /search/anything

I am new to redirects, I know it may be simple.

Another problem, I want to redirect specific URL which is /search/label/اضافات بلوجر to /blogger

the URL contains 2 Arabic words with a space separating them.

I tried this Rule but It does not work:

Redirect 301 /search/label/اضافات بلوجر https://mobtakr.com/blogger/

Any solutions? Thank you in advance

CodePudding user response:

I found the answer to my question. I want to add it for anyone that will have the same problem.

To redirect from /search/label/اضافات بلوجر to /blogger, I have used RedirectMatch with this regular expression اضافات\sبلوجر,

The final redirect rule is as follows:

RedirectMatch 301 /search/label/اضافات\sبلوجر https://mobtakr.com/blogger/

And to redirect URLs from /search/label/anything to /search/anything I have used this rule:

RedirectMatch 301 /search/label/([^/] ) https://mobtakr.com/search/$1

the regex [^/] simply matches anything that is not a slash.

So, Hope this is helpful to you.

  • Related