4

I have an old site with titles in the URL for SEO, but it has URL encoded characters than transliterated Latin characters. Like %20 instead of space character and many other non-Latin characters. The site is not in English.

I'm moving the site to a new CMS and it transliterates the titles before puttng them into URL bar (which is nice and I'm happy to have).

I'm writing 301 redirects in my .htaccess and they work if all characters of the title are in Latin (the same in both side).

How can I redirect the old encoded URLs to the new transliterated URLS using .htaccess?

1
  • Minor point... "html entities ... Like %20" - this is a URL (or percent) encoded character, not an HTML entity. HTML entities start & (ampersand). RewriteRule matches against the %-decoded characters. Have you tried saving your .htaccess file in UTF-8 and typing the non-latin characters directly?
    – MrWhite
    Oct 29, 2014 at 16:08

1 Answer 1

2

It should just work fine provided that the URL is enclosed in double-quotations.

For example, if you have:

  • Old URL: http://www.example.com/folder%20name/page%20name.html
  • New URL: http://www.example.com/folder/page

You can write:

Redirect 301 "/folder/page%20name.html" http://www.example.com/folder/page
1
  • 1
    For me, adding quotes and decoding the percent signs worked. E.g. "/folder/page name.html"
    – Phil_1984_
    Apr 6, 2016 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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