?
1. httpd.conf
添加:
<Directory />Options +Indexes +FollowSymLinks +MultiviewsAllowOverride allRequire all grantedRewriteEngine On</Directory>
開啟:
?
在phpinfo里找到:
說明開啟成功。
?
2.httpd-vhosts.conf (開啟虛擬主機的情況下)
注意這里的
Options Indexes FollowSymLinks
容易出錯,要明白每個參數的作用!!!
添加:
<VirtualHost *:80>ServerName "wap.500new.com"DocumentRoot "C:/wamp/www/lottery_frontnew_wrap/web"<Directory "C:/wamp/www/lottery_frontnew_wrap/web">Options Indexes FollowSymLinksAllowOverride AllOrder allow,denyAllow from all</Directory> </VirtualHost>
?
?3.在網站根目錄添加:
?
例如內容:
RewriteEngine On #RewriteBase /front RewriteRule ^(\w+)/(\w+)\.html$ index.php?act=$1&op=$2 [QSA]
?
?
?4.在php里寫:
var_dump($_GET);exit(0);
瀏覽器顯示:
?
?
?說明.htaccess配置生效
?