第一部分:httpd.conf
1:找到这段,改成如下这样
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
2:找到document root,改成如下
DocumentRoot "/Users/ruanwenwu/web"
<Directory "/Users/ruanwenwu/web">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/trunk/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
3.打开下面这段代码的注释
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
第二部分:http-vhost.conf配置如下
<VirtualHost *:80>
# ServerAdmin postmaster@dummy-host.localhost
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
ServerName localhost
# ServerAlias www.Domain.com
# ErrorLog "logs/Domain-error.log"
# CustomLog "logs/Domain-access.log" combined
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/ruanwenwu/web/www.doubilaile.com"
ServerName www.doubilaile.com
RewriteEngine on
RewriteRule ^/(d+)/?$ /Index/index/id/$1
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
一个配置localhost,一个配置自己想要的主机。