Resolving 403 forbidden page error for Wordpress blogs

January 7th, 2009

Well, yesterday I moved my blog from blogspot to wordpress using Wordpress’s awesome Importer tool and this tutorial. The action was mainly driven by the desire to host the blog on my own domain since that gives me a lot more flexibility to customize stuff as I want it to be. Luckily for me, my hosting provider (A2hosting.com) has a ready installation package for setting up a wordpress blog and so that part went pretty smooth. However, once I tried to open up the landing page of my blog, I got page forbidden (403) error. Incidentally, it was coming for every single page of the blog, including the wp-admin.

After a lot of hassle, I was finally able to resolve it and everything seems to be working alright since then. Nehow, I thought of putting down my observations here for anyone who may face similar issue with their installations or otherwise.

- The obvious things first - I checked the permissions on the installation folder (for me, <root>/blog) and found it to be perfectly ok (755 for read / execute to world).

- Next I checked the .htaccess in the root and so I found the problem. I had an earlier rails (Ruby on Rails) installation and following lines were present in it: -

RewriteEngine on

RewriteCond %{HTTP_HOST} ^sushain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.sushain.com$
RewriteRule ^contest http://127.0.0.1:12009%{REQUEST_URI} [P,QSA,L]
DirectoryIndex preload.html index.html
# BEGIN WordPress

# END WordPress

I immediately knew that the url rewriting module was causing some issue here, but I didn’t want to tinker with this since I may want my Ruby app (although dormant for now) to come alive again in future. So, what I did instead was that I changed the .htaccess file in the /blog folder from -

DirectoryIndex index.php
AuthUserFile “/home/sushainp/.htpasswds/public_html/blog/passwd”

to -

DirectoryIndex index.php
AuthUserFile “/home/sushainp/.htpasswds/public_html/blog/passwd”
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress

This overrode the url rewriting mechanism for /blog level addresses and thus, solved the issue.

Btw, for those of you interested in knowing more about url rewriting module, more information is available here.

Cheers !

Share/Save/Bookmark

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon

sushain Troubleshooting , , , , , ,

  1. November 13th, 2009 at 20:05 | #1

    I had to reply to this post thanks for you time and help.

  2. November 19th, 2009 at 22:01 | #2

    ,..] sushain.com is another great source on this subject,..]

  3. rosenzweigova
    September 20th, 2010 at 20:48 | #3

    This is truly a great advice!
    All of the others around the web describing the modification of .htacces didn’t work for me - but this one did!

    Thanks.

  4. September 20th, 2010 at 22:00 | #4

    Thanks. Glad you found it helpful.

  5. Michelle
    December 13th, 2010 at 23:06 | #5

    Thanks so much for this - it’s the only info that worked for me.

  6. March 18th, 2011 at 14:00 | #6

    Thanks for this!

    Really surprising how unhelpful forums are, even while they’re full of people with the same problem. It’s like they deliberately miss out steps to baffle and confuse.

  7. July 20th, 2011 at 20:47 | #7

    thank you for sharing with us, I conceive this website genuinely stands out : D.

  8. September 27th, 2011 at 18:03 | #8

    Hey thanks for this. I actually didn’t need to read the entire article but the opening tipped me off to check root permissions. That did the trick. I subbed, however, as your blog seems well written and containing useful code. Cheers.

  9. November 5th, 2011 at 03:09 | #9

    I met this problem again, then I tried many times from many posts, but it didn’t work .
    finally I fixed it.
    I leave here so that someone else could meet this again.

    the problem is the wordpress folder permission, I didn’t give ‘R’ perm to apache user, even though it has ‘x’ perm, then I add ‘r’ perm, use chmod o+r my-wp/

    then, it worked well, hope it helpful others.

  1. No trackbacks yet.