htaccess - 将博客移至子域
我有一个博客,我将其移动到子域。由于 URL sintaxis 不会相同,我只想将 /posts/ 内的所有 url 请求重定向到新的子域:
from
domain.com/posts/xxxxx
to< /strong>
blog.domain.com
这是我到目前为止所拥有的,但它仍然必须仅过滤内部 /posts/ 的请求
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://blog.domain.com/ [R=301,L]
i have a blog, and im moving it to a subdomain. since the URL sintaxis won't be the same, i just want to redirect all url requests that are inside /posts/ to the new subdomain:
from
domain.com/posts/xxxxx
to
blog.domain.com
this is what i have so far, but it still has to filter only the requests that are inside /posts/
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://blog.domain.com/ [R=301,L]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
指令:
...应该有效。
The directives:
... should work.
你快到了。您只需修改它,以便 RewriteRule 中的正则表达式仅匹配 /posts/ 中的内容,如下所示:
You're almost there. You just need to modify it so that your regular expression in the RewriteRule only matches stuff inside /posts/ as below: