只是希望将此长链接login.mydomain.com/myusersaccount/loginaccount/login.php提供给此login.mydomain.com,以便在我访问login.mydomain.com/myusersaccount/loginaccount/login.php时,它带我到这个login.mydomain.com,这是我在htaccess中使用的代码:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]
RewriteRule ^ %{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
RewriteCond %{HTTP_HOST} ^login\.mydomain\.com$ [NC]
RewriteRule ^$ http://login.mydomain.com/myusersaccount/loginaccount/login.php [R=301,L]
RewriteCond %{HTTP_HOST} !^login\.mydomain\.com$ [NC]
RewriteRule ^myusersaccount/loginaccount/login\.php$ http://login.mydomain.com {REQUEST_URI} [NE,R=301,NC,L]
RewriteCond %{HTTP_HOST} !^(www\.)?mydomain\.com$ [NC]
RewriteRule ^$ http://www.mydomain.com/ [NE,R=301,L]
答案 0 :(得分:0)
从此规则中删除R
标志,如下所示:
RewriteCond %{HTTP_HOST} ^login\.mydomain\.com$ [NC]
RewriteRule ^$ /myusersaccount/loginaccount/login.php [L]