Category Archives: Master and Server

How to deal with the 403 problem when changing your permalinks in WordPress

Every time I changed my permalink style in this WordPress install on the devio.us OpenBSD system, I get locked out of the entire blog, unable to access the dashboard or the live site. All I get is a 403 error in the browser.

I deleted the blog and its database multiple times but kept falling into the same trap: Change permalinks, get locked out, clear database, reinstall …

Then I went for help, and found it from moderator Samuel B the WordPress.org forum. The hack to fix this lies in the .htaccess file, both what’s in it and its permissions. From the above forum post, here is the hack:

delete present .htaccess
upload blank .htaccess
chmod 666
set permalinks to desired (in the WordPress Dashboard)
chmod .htaccess back to 644 for security

I did this in the shell (aka console aka command line). In my setup I don’t need rootly privileges to do any of this, so my shell lines begin with $ instead of #, and I don’t need to use sudo.

The first line gets me to my blog directory, the rest is the same wherever you are:
$ cd /public_html/blog
$ rm .htaccess
$ touch .htaccess
$ chmod 666 .htaccess

(Now reset permalinks in the WordPress Dashboard)
$ chmod 644 .htaccess