我试图在Windows服务器上设置一个子域进行开发,并且在httpd.ini文件中设置正确的细节时遇到问题,希望有人可以帮忙。
我已经build立了子域
http://dev.website.com
我想用于此子域的文件位于名为development的文件夹中的服务器上
http://www.website.com/development
在他们所在的目录结构中
/htdocs/development
我需要添加httpd.ini文件来将http://dev.website.com指向位于服务器上/htdocs/development文件夹中的文件?
是不是虚拟主机应该被实现为虚拟主机而不是重写?
http://httpd.apache.org/docs/1.3/vhosts/examples.html
dev.website.com / htdocs / development
<VirtualHost *:80> DocumentRoot /htdocs ServerName www.website.com ServerAlias website.com </VirtualHost> <VirtualHost *:80> DocumentRoot /htdocs/development ServerName dev.website.com ServerAlias www.dev.website.com </VirtualHost>
是的,我认为它的ISAPI重写。
@杰夫 – 感谢您的链接,我会看看,并尝试解决。
好吧,所以我尝试将以下内容添加到httpd.ini文件中,并且它不工作。 这是我需要做的吗?
#Fix丢失文件夹上的斜线字符 RewriteRule ^([^。?] + [^。?/])$ $ 1 / [R]
#修复重复的内容问题
RewriteCule%{HTTP:Host}。* myserver.com $ [NC] RewriteRule ^ / subdomain /([^/?]+)(.+)http://$1.myserver.com$2 [NC,R = 301]
#将请求映射到文件夹
RewriteCond%{HTTP:Host} ^(?! www。)([^。] +)。myserver.com [NC] RewriteRule(。*)/ subdomain /%1 $ 1