One of my photos

Kindness of strangers

June 26th, 2011 · Posted by Skuds in Life/Technology · 1 Comment · Life, Technology

I have been having a bit of a frustrating time with WordPress lately.

After not writing anything at all for ages – all my recent thoughts have been short enough to fit on Twitter or Facebook – I wrote a post today and when I hit ‘publish’ I did not get the normal message about it working OK, but got a 404 error page instead.  I hit the back button but that only gave me the bare bones of the draft: title only.

This has happened to me before and the last time it was with a really long post and at the time I assumed I had hit the wrong button.  It is a sort of rule of thumb to assume when something happens once it is a cock-up and only when it happens again to start looking for a pattern or reason.

I tried all sorts of things. I even gave in to the nagging from WordPress and upgraded it to the latest version and still the same thing happened.  I wrote a short test post and that worked fine, then tried the larger one again and it failed even though I wrote a far less wordy version than the first attempt.

A bit of Googling came up with this possible explanation.  It did not cheer me up because it described exactly the problem I was getting but the solution involved all sorts of technical stuff to do with mod_security and .htaccess files.

I tried a bit of playing around and looked at my .htaccess file for the first time in ages.  It didn’t look anything like how I remembered it.  Loads more stuff in it.

Anyway, I tried a short post about Glastonbury and that failed, but it was short enough that I could experiment with it and found that one word was causing the problem.  Bizarrely, it was the word “So”, which I am sure I have used before, but I replaced the S with its HTML code and it worked, so at least I had established that this whole mod_security thing was probably the cause.

I tried various suggestions from the web and didn’t really get anywhere.  Then I tweeted in frustration and a total stranger replied with a suggestion that I try going to the permalinks bit of settings in WordPress and save without changing anything.  I think it worked, although it is hard to be 100% certain.  At the moment I am assuming it did.

I think I vaguely understand why it might have worked too.  When you save the permalink settings WordPress writes to the .htaccess file.  I guess other actions in WP might also write to it, which would explain all the stuff in it that I didn’t put there.    I had a little look at the .htaccess file and compared it to the earlier version, which I had a copy of, and there was one section that was different, even though I had not changed any of the settings when I saved, so it is all very feasible.

How nice of Mr Ansley to chip in with a suggestion like that, which seems to have done the trick.

The irony is that he describes himself on his web page as “I am a husband, father, son, brother, believer, and a web developer living in Raleigh, NC” and the post which kicked all this off was one which was not 100% sympathetic to christians.  I feel a little bit bad now.


One Comment so far ↓

  • Skuds

    Yes – a bit waffly. This was in part a long test post to see if I would still get the 404 error but it all worked fine.