Articles - Written by Floogi on Monday, May 5, 2008 8:03 - 0 Comments

HTTP Error 403 Forbidden

Tags: ,

You don’t have permission to access / on this server.

You have just finished your website, you upload it to your web server and then, when you point your browser to your web site, then it happens. You get the Error 403 Forbidden - You don’t have permission to access / on this server, slammed right into your face, instead of your beautifully designed website.

However don’t worry the solution is, often, quite simple to fix. If you rent a managed server, just fire off a support ticket to your hosting company and they will fix it for you. If that is not the case, or you have your own web server locally on your desktop computer, then read on.

First, what does the 403 error mean?   It means that the server handled your request but it’s refusing to respond to it. It will not tell us why neither, it’s just responds with a big resounding NO!
So the error message itself, does not gives us any clue to what might be wrong. However, it gives us the information that you are not allowed to view the destination of the URL you provided, it might have been a directory or an individual file, like index.html.

If you got the 403 error by pointing your browser to  the 403 error tells us that your server is setup to prevent directory browsing, which I think it’s a good thing. However, if you had an index.html file in there, and you still get the 403 error, then it means that something isn’t right with the server’s configuration file. Don’t worry, that is easily fixed!

On a web server there is a file called httpd.conf that contains various information on how the server should behave in any given situation. The file is located at, /usr/local/etc/apache/httpd.conf on your server.

Just open that file and look for the entry, ‘DirectoryIndex’. The entry ‘DirectoryIndex’ tells the server which file that should be the default one to show, when a surfer request just a directory. So, lets clear things up with an example.

  1. A surfer point their browser to:
  2. The web server detects that this is a request for a directory, so it checks what DirectoryIndex tells it to show.
  3. The DirectoryIndex tells the web server to load up index.htm for the surfer.
  4. Unfortunately, in the directory something, there is no such file, there is just a file name index.html in there.
  5. Since the web server couldn’t locate the file, specified by DirectoryIndex, it decides that it’s best to call out the 403 Forbidden error, instead of a complete directory listing.

So to fix this all you have to do is to locate the DirectoryIndex and add the text, in this case, index.html to it, like this,

DirectoryIndex index.htm index.html

If you would like the server to throw up a php page, instead of a html page, you could add that one also,

DirectoryIndex index.htm index.html  index.php

After you have done your changes to  httpd.conf, you must restart your web server, with the command,

/usr/local/sbin/apachectl restart

Now, when you point your browser to  you will be able to, finally, see your page!



Leave a Reply

Comment

Most Popular Content

More In


More In


More In