我们正在为网站使用wordpress多站点。 我们有一些网址需要重定向到新的网址。 我们尝试了很少的htaccess重定向,但没有任何效果。
最后一行是我们无法使用的重定向。
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
#redirect mobile browsers
RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$
RewriteRule ^(.*)$ http://www.ourdomain.co.uk/blog [R=301,L]
RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$
RewriteRule ^(.*)$ http://www.ourdomain.co.uk/blog [R=301,L]
RewriteCond %{HTTP_USER_AGENT} ^.*Palm.*$
RewriteRule ^(.*)$ http://www.ourdomain.co.uk/blog [R=301,L]
RewriteCond %{HTTP_HOST} ^ourdomain.co.uk$
RewriteRule ^(.*) http://www.ourdomain.co.uk/$1 [QSA,L,R=301]
# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
RewriteCond %{QUERY_STRING} page=135
RewriteRule ^index\.php$ http://www.ourdomain.co.uk/about-us/$1? [R=301,L]
你有什么想法吗?
由于
答案 0 :(得分:0)
尝试将最后两行放在第一条规则之前,最后得到:
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} page=135
RewriteRule ^index\.php$ http://www.ourdomain.co.uk/about-us/$1? [R=301,L]
RewriteRule ^index\.php$ - [L]