2013-05-16 30 views
2

我在我的Wordpress網站中更改了我的URL結構。所以我使用.htaccess文件來重定向URLS。當我在.htaccess中的網址添加以下代碼www.mydomain.com/test/?lang=en正確地重定向到www.test.com在htaccess中重定向俄語網址不起作用

RewriteEngine On 
RewriteCond %{QUERY_STRING} ^lang=en$ [NC] 
RewriteRule ^test/$ http://www.test.com/? [R=301,NE,NC,L] 

我的網站也是俄羅斯人。 我的目標是將www.mydomain.com/шарон/?lang=RU重定向到www.test.com

我嘗試添加以下代碼爲.htaccess:

RewriteCond %{QUERY_STRING} ^lang=RU$ [NC] 
RewriteRule ^%D1%88%D0%B0%D1%80%D0%BE%D0%BD/$ /www.test.com? [R=301,NE,NC,L] 

但重定向不能正常工作。我得到了一個「無法顯示頁面」的錯誤,我認爲是404錯誤。

我也嘗試將俄文文本添加到.htaccess文件中。並將.htaccess保存爲UTF-8文件格式。

RewriteCond %{QUERY_STRING} ^lang=RU$ [NC] 
RewriteRule ^шарон/$ /www.test.com? [R=301,NE,NC,L] 

然後我收到下面的消息,我的網站無法訪問了。

Internal Server Error 
The server encountered an internal error or misconfiguration and was unable to complete your request. 

Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error. 

有關此錯誤的更多信息可能在服務器錯誤日誌中可用。

有沒有人有一個想法如何重定向我的俄羅斯網址?

回答

3

我不確定是否可以在重寫時指定URL。嘗試將其更改爲

RewriteCond %{QUERY_STRING} ^lang=RU$ [NC] 
RewriteRule ^\xd1\x88\xd0\xb0\xd1\x80\xd0\xbe\xd0\xbd/$ /www.test.com? [R=301,NE,NC,L] 

\ XD1 \ X88 \ XD0 \ XB0 \ XD1 \ X80 \ XD0 \ XBE \ XD0 \ XBD

等於

%D1%88%D0%B0%D1%80%D0%BE%D0%BD

,因此也

шарон

希望它能幫助。如果您還有其他問題,請對此評論。 ;)

+0

謝謝,謝謝!就是這樣,我只需要用\ x來改變%。 有時如果你知道的話很容易:)。 – user2389168