我想创建一个注册表单来创建子域(但在本地主机上),但我遇到了一些问题。我知道如何创建子域,在虚拟主机例如写这些:本地主机上的子域
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/wamp/www/something/"
ServerName localhost
ServerAlias something.localhost
ErrorLog "logs/error.log"
CustomLog "logs/access.log" common
</VirtualHost>
,并把这个行内的主机:
127.0.0.0 something.localhost
它的工作,但我想的是,当我注册一个新的子域(例如:other),然后当我尝试打开other.localhost时,它会打开指定的文件夹(../www/other/)。 我在vhosts中使用“ServerName * .localhost”,“ServerName localhost”,“ServerAlias * .localhost”,“ServerAlias localhost”以及主机“127.0.0.1 * .localhost”在所有这些排列中对其进行了尝试,但这些都不适合我。 我曾经想过,在注册时,我在虚拟主机中添加了一个新的数据块,并提供了最佳数据,但我认为这不是很安全/可行,或者是最好的方法。
希望有人能帮助我!
在此先感谢!
重写规则进入htaccess的?我从来没有在本地主机上试过htaccess,所以它放在索引文件所在的同一个文件夹中? – matthew3r
检查[mod_rewrite上的apache文档](http://httpd.apache.org/docs/current/mod/mod_rewrite。html):rewriterules进入包含在conf.d中的文件。 – Konerak