我有qpressnslate插件的wordpress网站。 俄语是默认的(ru)。 我有页面: http://example.com/en/xxx http://example.com/ru/xxx(302重定向到http://example.com/xxx) http://example.com/xxx
我需要创建301从http://example.com/ru/xxx重定向到http://example.com/xxx
我试图在htacess中为重定向编写规则,但我得到了重定向循环:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://example.com.ua/ [R=301,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://example.com.ua/ [R=301,L]
RewriteCond %{HTTP_HOST} ^www.example\.com.ua$ [NC]
RewriteRule ^(.*)$ http://example.com.ua/$1 [R=301,L]
RewriteCond %{REQUEST_URI} !^/ru(/|$)
RewriteRule ^(.*)$ /$1 [R=301]
</IfModule>
# END WordPress
答案 0 :(得分:2)
请尝试以下规则: -
Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
>>>
OR
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /ru/$1 [NC,L,QSA]
希望它对您有用:)