Home >Backend Development >PHP Tutorial >泛域名解析,怎么让子域名绑定子目录

泛域名解析,怎么让子域名绑定子目录

WBOY
WBOYOriginal
2016-06-13 11:09:401428browse

泛域名解析,如何让子域名绑定子目录?
域名 a.com  泛域名解析到ip 8.8.8.8
主机绑定域名a.com
然后首页列出 二级域名  希望

1.a.com  绑定 /wwwroot/1
2.a.com  绑定 /wwwroot/2
3.a.com  绑定 /wwwroot/3
4.a.com  绑定 /wwwroot/4
5.a.com  绑定 /wwwroot/5

不用手动去绑定,随便生成的二级域名绑定到相应的二级目录
这个要怎么做?用伪静态吗  还是?
------解决方案--------------------
#让1.a.com访问/wwwroot/1目录
RewriteCond %{HTTP_HOST} ^1.a.com$ [NC]
RewriteCond %{REQUEST_URI} !^/wwwroot/1/
RewriteRule ^(.*)$ /wwwroot/1/$1
RewriteCond %{HTTP_HOST} ^1.a.com$
RewriteRule ^(/)?$ /wwwroot/1/index.html [L]

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn