Apache的安裝目錄在:/etc/apache2/php
sudo vi /etc/apache2/httpd.conf」,打開Apche的配置文件html
在httpd.conf中找到「#Include /private/etc/apache2/extra/httpd-vhosts.conf」,去掉前面的「#」,保存並退出。apache
sudo vi /etc/apache2/extra/httpd-vhosts.confspa
<VirtualHost *:80>rest
ServerAdmin gk@qq.comhtm
DocumentRoot "/Library/WebServer/Documents"it
ServerName gaokaos配置
RewriteEngine onfloat
RewriteRule ^/l-(.+?)\-(.+?)\-(.+?)\-(.+?)\.html$ /e/extend/daxue/index\.php\?sf=$1&ty=$2&ts=$3&page=$4&error
RewriteRule ^/d-(.+?)\.html$ /e/extend/daxue/details\.php\?sid=$1
ErrorLog "/private/var/log/apache2/gk-error_log"
CustomLog "/private/var/log/apache2/gk-access_log" common
</VirtualHost>
sudo vi /etc/apache2/extra/httpd-vhosts.conf
127.0.0.1 gaokaos
運行「sudo apachectl restart」,重啓Apache後就開啓了虛擬主機配置功能。