Question

I am currently working on a site in Hebrew, a large portion of links in this site have changed and i am now setting up the redirect rules through .htaccess; for some reason the redirect rules are not working. The old website was a static html website and this one a wordpress site.

The basic redirect syntax i am using is.

Redirect 301 /oldurl.html http://samedomain.co.il/newurl/

This works fine for all links with normal url encoding for the english version of the site; this even works when the redirect is to a page which its url encoded as such:

Redirect 301 /oldurl.html http://samedomain.co.il/%D7%A4%D7%A8%D7%96%D7%A0%D7%98%D7%A6%D7%99%D7%94-%D7%91%D7%90%D7%A0%D7%92%D7%9C%D7%99%D7%AA/

But does not work when the first part is also URL encoded as such:

Redirect 301 /%D7%A7%D7%95%D7%A8%D7%A1%D7%99%D7%9D-%D7%95%D7%A1%D7%93%D7%A0%D7%90%D7%95%D7%AA.htm http://samedomain.co.il/%D7%A4%D7%A8%D7%96%D7%A0%D7%98%D7%A6%D7%99%D7%94-%D7%91%D7%90%D7%A0%D7%92%D7%9C%D7%99%D7%AA/

I have tried several things, such as:

  1. Removing the forward slash.
  2. Encoding the slash to %47.

I am running out of ideas, any help would be appreciated.

Was it helpful?

Solution

You need to use the decoded pattern, not the encoded one. The URI's get decoded before mod_alias/mod_rewrite get applied.

Redirect 301 /קורסים-וסדנאות.htm http://samedomain.co.il/%D7%A4%D7%A8%D7%96%D7%A0%D7%98%D7%A6%D7%99%D7%94-%D7%91%D7%90%D7%A0%D7%92%D7%9C%D7%99%D7%AA/
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top