Latest Register Log In

+ Advanced Search

403 Forbidden

403 Forbidden
By
Oct 14, 2004 (Edited Mar 11, 2014)

403 forbidden errors can have many different causes:

Web server modsec POST restrictions. Some web servers will not allow you to submit certain content in any form. Modsec is designed to throw 403 forbidden errors when you attempt to submit form content that it deems suspicious, with the end result being that you get random errors various places. There are servers that won't allow you to submit php content, and mysteriously there's at least one server that forbids using two consecutive linebreak html tags (<br><br>) anywhere, such as in the terms of service on the member settings page. In such cases you should ask your webhost to either correctly configure or disable modsec -- upload the following content as test.html on your site to test that this is indeed your problem:
Produces 403 forbidden:<br>
<form action="test.html" method="post">
<textarea name="test" rows="6" cols="50"><br><br></textarea>
<br>
<input type="submit">
</form>

Produces 403 forbidden:<br>
<form action="test.html" method="post">
<textarea name="test" rows="6" cols="50"><?php
$jan1 = strtotime("January 1, $year 12:00 AM");
$dec31 = strtotime("December 31, $year 11:59 PM");
echo $db->selectcount('statstable', "anything here");
?></textarea>
<br>
<input type="submit">
</form>


OK (no error):<br>
<form action="test.html" method="post">
<textarea name="test" rows="6" cols="50"><br></textarea>
<br>
<input type="submit">
</form>


Show that page to your web host.

You may also edit the templates via ftp or find another way to write out the same goal, but should really get your web host involved.

Another possible cause of a 403 is any PHP error, being cloaked to a generic 403. Some web server configurations will show a 403 instead of the actual error messages. Usually the real error message is logged to a file.

Bad file permissions can also cause a 403 Forbidden. If the server has suPHP, using a 777 chmod will often result in a 403 error. Another possibility, with or without suPHP, is a directory chmoded to lack execution permissions (666 for example). Change files to 644 and directories to 755 to fix.

Finally, bad .htaccess file content can be the problem. Try deleting .htaccess to check if that's the issue.




Description What to do if you get a 403 forbidden error on your pages.
Rating
Views 2,631 views. Averaging 1 view per day.