将子域重写为目录 [英] Rewrite sub-domain to directory
本文介绍了将子域重写为目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用查看主机名并简单转发的内部 URL 重写将 subdomain.example.com
映射到 www.example.com/subdomain
对与子域同名的子目录的任何请求.
I'd like to map subdomain.example.com
to www.example.com/subdomain
using an internal URL rewrite that looks at the host name and simply forwards any request to a subdirectory with the same name as the subdomain.
感谢您的帮助
推荐答案
使用 .htaccess:
Using .htaccess:
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
这篇关于将子域重写为目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文