|
apache的rewrite模块实现虚拟主机功能,主要便于php开发
我使用xampp做为开发环境,xampp为最新版本1.7.1
在/opt/lampp/htdocs/中写了.htaccess,内容如下
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.[^.]+\.host\.com$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^www\.([^.]+)\.host\.com(.*) /home/$1$2
RewriteCond %{HTTP_HOST} ^[^.]+\.localhost$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+)\.localhost(.*) $1/src/$2
第一部分抄的官方手册,见:http://httpd.apache.org/docs/2.2 ... ide.html#uservhosts
第二部分是为了用与自己的开发情况改写的
/etc/hosts增加两行
访问域名:
http://www.liguang.host.com/
出错, 运行的结果为:
[an error occurred while processing this directive] You don't have permission to access the requested object. It is either read-protected or not readable by the server. [an error occurred while processing this directive]
访问域名:
http://xuanai.localhost/
错误提示一样
google了很多,sir上关于此的文章基本都看了,原理如官方手册,但是错误,为何?
是xampp的设置导致了这个错误,还是apache官方手册写错了呢?
这个问题困扰了很久,希望能够解决,谢谢 |
|