2011-03-22 315 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