我的网站的mod_rewrite规则

时间:2014-07-19 17:04:31

标签: apache .htaccess mod-rewrite redirect

我的网站上有这些规则:

RewriteCond $1 !^(support|about-us|profile|support|features|videos|terms-of-service|about-us|signup|media|includes|modules|cgi-bin|templates|xmlrpc|language|libraries|plugins|administrator|component|images|dev|data)
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([a-z0-9\-]+)/[^\ ]*\ HTTP/
RewriteCond %{DOCUMENT_ROOT}/$1 -d
RewriteRule ^([a-z0-9\-]+)/(.*)$ https://$1.example.com/$2 [R=301,L]

RewriteCond %{HTTP_HOST} ^([a-z0-9\-]+)\.example\.com
RewriteCond %1 !^www\.
RewriteRule ^(support|about-us|profile|support|features|newserver|videos|about-us|terms-of-service|signup|component|includes|media|cgi-bin|templates|xmlrpc|language|modules|libraries|plugins|administrator|images(/.*))$ https://example.com/$1 [R=301,L]

 # Externally redirect all www hostnames to non-www hostnames
 RewriteCond %{HTTP_HOST} ^(([a-z0-9\-]+\.)*)www\.(([a-z0-9\-]+\.)*)example\.com
 RewriteRule ^(.*)$ https://%1%3example.com/$1 [R=301,L]

我在下面添加了以下内容来重定向这些类型:https://example.com/firstnamelastname?mv=0

 RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]
 RewriteCond %{QUERY_STRING} ^mv=[0-4]$
 RewriteRule ^([A-Za-z0-9]+)$ https://$1.example.com/? [L,R]

但是我无法重定向https://example.com/firstnamelastname

如果我从最后3行删除查询字符串,那么如果我点击我网站上的功能链接它将重定向到https://features.example.com这是顶部的规则阻止。

任何人都可以帮忙解决这个问题。

0 个答案:

没有答案