.htaccess file causes "500 Internal Server Error" but no error log entry
9,536
Enable mod_rewrite in Apache web server. Also try this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?params=$1 [L,QSA]
<Files "test">
Order Allow,Deny
Allow from all
</Files>
</IfModule>
If mod_rewrite is enabled then initiates the rewrite engine; else it does nothing.
Author by
Edward Tanguay
Updated on September 18, 2022Comments
-
Edward Tanguay over 1 year
I set up an apache manually and added a second web directory with this code:
Alias /webs c:\webs <Directory /webs> AllowOverride All </Directory>
However, this web has an .htaccess file in it and accessing the website gives the error: "500 Internal Server Error", but does not write anything in the error log file.
But when I remove the .htaccess file, I don't get this error.
I added the "AllowOverride All" line and restarted the server but this doesn't correct the error.
My .htaccess is this:
RewriteEngine On RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?params=$1 [L,QSA] <Files "test"> Order Allow,Deny Allow from all </Files>
What do I have to do so that I can use an .htaccess file in this directory?