Archive

Posts Tagged ‘wordpress’

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

Troubleshooting , , , , , ,