2011-03-22 158 views
3

我已經完成了xampp的全新安裝,安裝後包含以下文件夾的htaccess文件未顯示在我的瀏覽器中。.htaccess無法正常工作

SetEnv APPLICATION_ENV development 

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 

它提供了500錯誤和服務器超載

發生這種情況時,我想在我的Zend應用程序執行的公用文件夾。

請向我建議我是否必須在我的xampp中進行任何修改,以使我的.htaccess文件正確執行。

在此先感謝

+0

apache錯誤日誌中有什麼錯誤? – sarnold 2011-03-22 11:04:05

+0

你有沒有在Apache中啓用mod_rewrite模塊? – emaillenin 2011-03-22 11:06:47

+0

apache的錯誤日誌是[Tue Mar 22 16:38:46 2011] [alert] [client 127.0.0.1] D:/xampp/htdocs/gowtham/test1/public/.htaccess:無效的命令'RewriteEngine',可能拼寫錯誤或由服務器配置中未包含的模塊定義,referer:http:// localhost/gowtham/ – oldrock 2011-03-22 11:11:12

回答

5

1)確保你在Apache配置文件中啓用mod_rewrite

2)將行AllowOverride All添加到Apache配置文件中的目錄配置中。

此外,除非您有很多重寫,否則我會根據您當前的規則推薦以下內容。

SetEnv APPLICATION_ENV development 

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-s 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^.*$ index.php [NC,L] 
+0

它不適用於我的情況:http://superuser.com/questions/473556/我怎麼做我安裝apache-on-my-ubuntu-12-04-where-has-virtualhost – YumYumYum 2012-09-13 11:07:05

+0

我已經完成了1,2,3,但仍然保持不變。 – YumYumYum 2012-09-13 11:07:21

+0

YumYumYum,我看不出我的答案與你連接的問題有什麼關係。 – nitro2k01 2012-09-26 03:38:42