.htaccess not working

2019-07-07 06:58发布

问题:

I have done a fresh installation of xampp , after installing the folder containing following htaccess file is not showing in my browser.

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]

it gives 500 error and the server is overloaded

This happens when I am trying to execute the public folder in my zend application.

Please suggest to me whether I have to do any modifications in my xampp for getting my .htaccess file to execute correctly.

Thanks in advance

回答1:

1) Make sure you've enabled mod_rewrite in the Apache configuration file.

2) Add the line AllowOverride All to the directory configuration in the Apache config file.

Additionally, unless you have a lot of rewrites, I recommend the following over your current rules.

SetEnv APPLICATION_ENV development

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