user3739977
user3739977

Reputation: 1

Redirect 301 not working because of Long Dash (special character)

I've got an issue when redirecting one of my blog's url:

http://suitelife.com/category/moving-to-barcelona-tips/barcelona-legality%E2%80%93barcelona-shopping-health-public-transport

As you can see the %E2%80%93 is a pain in the a**, I looked at diverse forums, but no solution there appeared to solve my situation.

I put that line in the .htaccess :

RewriteRule ^category/moving-to-barcelona-tips/barcelona-legality([^.%E2%80%93])barcelona-shopping-health-public-transport(.*)$ category/moving-to-barcelona-tips/barcelona-day-life$1 [R=301,L]

P.S: I've got RewriteEngine On and RewriteBase / etc. I've already redirected other URLs, just this one is not working.

Many thanks in advance! :)

Florian

Upvotes: 0

Views: 214

Answers (1)

anubhava
anubhava

Reputation: 785128

You can use take regex help to avoid matching that character:

RewriteRule ^category/moving-to-barcelona-tips/barcelona-legality.*?barcelona-shopping-health-public-transport(.*)$ category/moving-to-barcelona-tips/barcelona-day-life$1 [R=301,L,B]

Note use of .*? instead of that character to match any arbitrary string there.

Upvotes: 1

Related Questions