htaccess 301 使用编码的希伯来语 URL 重定向 [英] htaccess 301 redirect with encoded hebrew URLs
问题描述
我目前正在开发一个希伯来语网站,该网站中的大部分链接已更改,我现在正在通过 .htaccess
设置重定向规则;由于某种原因,重定向规则不起作用.旧网站是一个静态的 html 网站,而这个网站是一个 wordpress 网站.
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/
这适用于网站英文版的所有具有正常 url 编码的链接;这甚至在重定向到其 url 编码为这样的页面时也有效:
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/
但是当第一部分也是 URL 编码时不起作用:
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:
- 删除正斜杠.
- 将斜杠编码为 %47.
我的想法不多了,任何帮助将不胜感激.
I am running out of ideas, any help would be appreciated.
推荐答案
您需要使用解码模式,而不是编码模式.在应用 mod_alias/mod_rewrite 之前对 URI 进行解码.
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/
这篇关于htaccess 301 使用编码的希伯来语 URL 重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!