htaccess 仅重写子域
我正在尝试为子域进行重定向,但我无法弄清楚。 这就是我现在所拥有的:
RewriteCond %{HTTP_HOST} ^(mysubdomain).myhost.com$ [NC]
RewriteRule (.*) http://www.myhost.com/folder/index.html [R=301,L]
但是当我在浏览器中转到子域地址时,没有重定向。
我只需要一个特定的子域。 我哪里出错了?
I am trying to make a redirect for a subdomain but i can't figure it out.
This what I have now:
RewriteCond %{HTTP_HOST} ^(mysubdomain).myhost.com$ [NC]
RewriteRule (.*) http://www.myhost.com/folder/index.html [R=301,L]
But when I go to the subdomain address in my browser, there's no redirect.
I need this for only one specific subdomain.
Where am I going wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应该是:
Should be:
尝试一下这一点,因为您只需要来自一个域的它。 () 在这两种情况下都是毫无意义的。特别是在第二行,您没有将旧 URL 传递给新 URL。
Try this, since you only need it from one domain. The () are pointless in both cases. Especially on the 2nd line where you aren't passing the old URL to the new URL.