I am using xampp to test out some php code.
In the main project directory, I have the following .htaccess file:
RewriteEngine on
#Index
RewriteCond %{REQUEST_FILENAME} ^/$
RewriteRule request_handler.php [L]
#php files
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} ^.*(\.php)$
RewriteRule . request_handler.php [L]
#Blocked files. PHP blocked files should be specified in request_handler.php
<Files "setup.json">
Order Allow,Deny
Deny from all
</Files>
<Files "testimonials.json">
Order Allow,Deny
Deny from all
</Files>
#CACHE CONTROLL FOR STATIC RESOURSES
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
Anyhow, I am getting an unexpected 403 forbidden in all my requests. If I remove the first line of the .htaccess file though, I stop getting that unsuspected behavior.
Does anyone know what might be causing this error?
UPDATE
I have created a new .htaccess file, that only contains one line: RewriteEngine On and I still get the error. (If I remove that line, I stop getting the error). The sole presence of that line causes the error.
Turns out, all I had to do was add the line Options FollowSymLinks before the RewriteEngine On directive.
Here's what Apache has to say:
To enable the rewrite engine in this context, you need to set "RewriteEngine On" and "Options FollowSymLinks" must be enabled. [...] This restriction is required for security reasons.