windows apache 动态域
我有 Windows 7 + Zend 服务器
在 httpd.conf 文件中我有:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin keyne@localhost
ServerName local-izbori.bg
ServerAlias *.local-izbori.bg
DocumentRoot "C:\Program Files\Zend\Apache2\htdocs\izbori-www"
<Directory 'C:\Program Files\Zend\Apache2\htdocs\izbori-www'>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
在 windows 主机文件中:
127.0.0.1 local-izbori.bg
在我的 .htaccess 文件中:
Options +FollowSymLinks
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|php|doc|docx|pdf|swf|htm|php|htc)$ index.php
url 重写工作查找,例如: local-izbori.bg/members/register/
但动态子域,例如 < a href="http://ruse.local-izbori.bg/ruse" rel="nofollow noreferrer">http://ruse.local-izbori.bg/ruse 返回:找不到服务器
有什么方法可以让所有子域都转到index.php 吗?
I have Windows 7 + Zend server
In httpd.conf file i have:
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin keyne@localhost
ServerName local-izbori.bg
ServerAlias *.local-izbori.bg
DocumentRoot "C:\Program Files\Zend\Apache2\htdocs\izbori-www"
<Directory 'C:\Program Files\Zend\Apache2\htdocs\izbori-www'>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
in windows host file:
127.0.0.1 local-izbori.bg
And in my .htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|php|doc|docx|pdf|swf|htm|php|htc)$ index.php
url rewrite work find, ex: local-izbori.bg/members/register/
but dynamic subdomain, like http://ruse.local-izbori.bg/ruse return: Server not found
is there any way to do all subdomain to go to index.php ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看通配符子域。为了让它们正常工作,您需要将该子域添加到您的 DNS 中。
我假设你在windows上。不幸的是,Windows 不支持通配符定义,因此您必须在主机文件中为每个子域添加一行。
Look into wildcard subdomains. In order for them to work you need to add that subdomain to your DNS.
I asume you are on windows. Unfortunately windows does not support wildcard definition so you will have to add a line for each subdomain to your hosts file.