2

我正在更改我的 Wordpress 网站中的 URL 结构。所以我使用 .htaccess 文件来重定向 URL。当我在 .htaccess 中添加以下代码时,网址www.mydomain.com/test/?lang=en会正确重定向到www.test.com

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

我的网站也是俄语的。我的目标是重定向www.mydomain.com/шарон/?lang=RUwww.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.

服务器错误日志中可能提供有关此错误的更多信息。

有谁知道如何重定向我的俄罗斯网址?

4

1 回答 1

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

因此也

шарон

希望能帮助到你。如果您还有其他问题,请对此发表评论。;)

于 2013-05-16T11:50:22.800 回答