Can .htaccess 301 redirects work with encoded characters?

Can .htaccess 301 redirects work with encoded characters? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Can .htaccess 301 redirects work with encoded characters? error on your web browser. Problem :


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?


Solution :

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

We hope that this article has helped you resolve the htaccess, redirects, url error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

Redirected urls show in serp, with the original permalink but with the title and meta of the target page

How can I redirect everything but the index as 410?

How do I redirect traffic only if being accessed from a specific port?