我正在尝试重定向
新闻/事件/finance-for-sdgs-high-level-meeting-bellagio-financeforsdgs-2/?lang=zh-hans
至
/finance-for-sdgs-high-level-meeting-financeforsdgs-bellagio-25-27-february-2015/?lang=zh-hans
但不确定编码。以下内容无效:
RewriteRule ^æ°é»/äºä»¶/finance-for-sdgs-high-level-meeting-bellagio-financeforsdgs-2/?lang=zh-hans$ http://ecosequestrust.org/finance-for-sdgs-high-level-meeting-financeforsdgs-bellagio-25-27-february-2015/?lang=zh-hans [R=301,L]
最佳答案
您可以尝试使用\x
转义序列来转义Unicode:
RewriteRule ^\xE6\x96\xB0\xE9\x97\xBB\x2F\xE4\xBA\x8B\xE4\xBB\xB6/finance-for-sdgs-high-level-meeting-bellagio-financeforsdgs-2/$ http://ecosequestrust.org/finance-for-sdgs-high-level-meeting-financeforsdgs-bellagio-25-27-february-2015/ [R=301,L]
本质上,将新闻/事件
替换为\xE6\x96\xB0\xE9\x97\xBB\x2F\xE4\xBA\x8B\xE4\xBB\xB6
。这样,您就不需要依赖 htaccess 文件的编码。
关于.htaccess 带有中文字符的重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30488279/