Server error 500 when adding .htaccess file in the root folder

12,323

Solution 1

I've encountered this error when I've tried to use features of .htaccess not allowed in the Apache AllowOverride configuration parameter. If you have access to your Apache configuration, try setting this to the level you need, or maybe All to allow full .htaccess capabilities.

Solution 2

First, Go to your apache’s httpd.conf file I my case its “C:\xampp\apache\conf\httpd.conf”

The lines beginning with # indicate that these are comments Remove the comments for these below mentioned lines

LoadModule deflate_module modules/mod_deflate.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
Share:
12,323
welou
Author by

welou

Updated on July 31, 2022

Comments

  • welou
    welou almost 2 years

    I read a lot of server error 500 questions related to the famous .htaccess file...but I have still not found an answer to this error.

    I have a folder which i used to test the .htaccess file.

    =>http://localhost/xampp/example/

    I copied the .htaccess in the example folder and I get server error 500

    I checked in my error.log file and found this: .htaccess RewriteEngine not allowed here

    But I changed all AllowOverride None to AllowOverride All in my httpd.conf file I also uncommented the line LoadModule expires_module modules/mod_expires.so

    error log says: ExpiresActive not allowed here

    what is actually happening??...how can I resolve this error??

    This is what I have in my .htaccess file now...

    <ifModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 days"
    </ifModule>