mac中的apache預設是關閉.htaccess的功能,那要如何打開呢?
研究了半天,到快睡著了,才找到。
apache的主設定檔
/private/etc/apache2/http.conf
user home相關的設定
/private/etc/apache2/users
所以若要打開user home中.htaccess的功能,就要到/private/etc/apache2/users去找user的設定囉~~
我這台的設定如下:
原本:
<Directory "/Users/wind/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
變更為:
<Directory "/Users/wind/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
http server重新啟動,然後就可以在home目錄底下使用.htaccess啦~~~
ps:.htaccess中,要加一個選項,才不會出現403 Forbidden的錯誤,
我的.htaccess的設定如下:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /~onnie/webpath/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
0 意見:
張貼留言