[英]How to redirect root to sub-domain with .htaccess
我有像example.com这样的域名。 我希望将其上的所有流量发送到sub.example.com。
目前我正在使用此代码,但它发送到example.com/sub:
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteCond $1 !^sub
RewriteRule ^(.*)$ /sub/$1 [L]
有没有办法做到这一点?
我认为你必须使用R标志: Forces an external redirect, optionally with the specified HTTP status code.
细节...
RewriteRule (.*) http://... [L,R]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.