Resolving 403 forbidden page error for WordPress blogs

Few years back, I decided to move and completely re-purpose my blog from Blogger/Blogspot to WordPress. The transition was mainly driven by a desire to host the blog on my own domain since that gives me a lot more flexibility to customize and manage the content. Luckily, my hosting provider had a ready installation package for setting up a wordpress blog and so that part went relatively smoothly. However, once I tried to launch the landing page of the blog, I got page forbidden (403) error. Incidentally, it was occurring on every relative URL/page for the blog (including /wp-admin). After quite a bit of hassle, I was eventually able to resolve the issue and things seemed to work alright from that point onward. I thought of documenting an abbreviated version of the procedure in case anyone else might run into a similar problem while transitioning their blog to WordPress.

Firstly, I checked the permissions on the installation folder (in my case, <root>/blog) and found it to be OK (755 for read / execute to world).

Next, I checked .htaccess located under /root folder. I had a prior Ruby on Rails install that had the following configuration –

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 had a hunch that the URL rewriting module might’ve been misbehaving, but didn’t want to tinker with it since I may have needed the RoR app (dormant at the time) to come alive sometime in the future. What I did instead was to change 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 effectively ended up overriding the URL rewriting defaults for everything matching /blog/* URL pattern and thus, resolved the issue. For those of you interested in learning more about URL rewriting module, more information is available here.

Cheers!

11 thoughts on “Resolving 403 forbidden page error for WordPress blogs

  1. 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.

  2. 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.

  3. 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.

  4. 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.

  5. Neat blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple tweeks would really make my blog jump out. Please let me know where you got your design. Thanks fedddkfdkfaf

Leave a Reply

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