本地php虚拟环境怎样添加其他域名
如我的电脑虚拟环境地址是
http://localhost/,
我想增加一个http://www.abc.com/
即用 http://localhost/ 或 http://www.abc.com/ 都是访问我的电脑虚拟环境根目录。
还有我想让 http://localhost/game 能用 http://www.xyz.com 访问 ,能做到吗?
是改host文件吗,怎样改法?
如我的电脑虚拟环境地址是
http://localhost/,
我想增加一个http://www.abc.com/
即用 http://localhost/ 或 http://www.abc.com/ 都是访问我的电脑虚拟环境根目录。
还有我想让 http://localhost/game 能用 http://www.xyz.com 访问 ,能做到吗?
是改host文件吗,怎样改法?
RewriteCond %{HTTP_HOST} ^(www.)?xyz.com$
RewriteRule ^(/)?$ game/index.php [L]
#<VirtualHost *:80>
# ServerAdmin [email protected]
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
我在httpd.conf中添加以下内容
#my add#
<VirtualHost *:80>
DocumentRoot /sitestar (这里无论是localhost/sitestar还是127.0.0.1/sitestar都出现这个错误)
ServerName www.my_sitestar.com
</VirtualHost>
#my add end
然后重启apache,出现以下错误为什么?
参考
http://blog.163.com/wangzhenbo85@126/blog/static/10136328220101115101938756/c:\WINDOWS\system32\drivers\etc\hosts
添加
127.0.0.2 www.my_sitestar.comhttpd.conf中添加
#my add
NameVirtualHost 127.0.0.2:80
<VirtualHost 127.0.0.2:80>
DocumentRoot ../htdocs/sitestar
ServerName www.my_sitestar.com
</VirtualHost>
#my add end