问题
just wish to present this long link login.mydomain.com/myusersaccount/loginaccount/login.php, to this login.mydomain.com, so that when i access login.mydomain.com/myusersaccount/loginaccount/login.php, it take me to this login.mydomain.com, here is the code i use in 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]
回答1:
Remove the R flag from this rule like this:
RewriteCond %{HTTP_HOST} ^login\.mydomain\.com$ [NC]
RewriteRule ^$ /myusersaccount/loginaccount/login.php [L]
来源:https://stackoverflow.com/questions/20951304/i-want-to-make-a-htaccess-to-have-a-short-link