How To Fix 403 Forbidden Error from htaccess File

As a web developer, you will likely need to make rewrites for clean URLs and produce an htaccess file so you can create ModRewrite rules.

If you encounter a 403 Forbidden Error after creating the htaccess file. This happens because even though the htaccess file itself may have the right permissions, it is possible the web server is not explicitly allowing the rewrites for that directory.

To check for this you should take a look at the webserver error log. The webserver error log may be in different locations depending on your operating system. On Mac OS X it’s in /var/log/apache2/error_log, on most Linux boxes it’s in /var/log/httpd/error_log

for example, you can view the last few errors in the error log by using the tail follow command in the linux command line like this:

If you see an error like this:

Then you can fix the issue by adding the following line to the top of the .htaccess file:

So that it may look something like this ( the other code should be code specific to your own set up). The important thing to know is that by adding Options +FollowSymLinks you explicitly allowing the rewrites.

If you are comfortable editing your Apache httpd.conf file, you can add the Options +FollowSymLinks to the directory directive like this:

Leave a Reply

Your email address will not be published. Required fields are marked *