WordPress 404 error on preview.. aka this is embarrassing error

I was having no luck finding a solution for this issue, so I figured I’d blog about it for posterity (so I can find it next time when I forget what I did). I recently setup a new blog about business continuity. I set everything up like this blog and my python blog, and everything seemed to work fine. I put my intro post out without a problem.

The next time I go to post, I put my first draft in and go to preview the post. This time, I get a message telling me the site is so embarrassed this happened but the page cannot be found. While this 404 error is kinda funny, I had no idea why I was getting it. Also, I could still post without issue. It was preview only that wasn’t working.

I must have played with the permalinks a hundred times including editing the .htaccess file directly. I searched on WordPress’s site and constantly came across the resolution of it’s your web browser. Clear your cache. Not so in my case. I tried it from several computers.

After this, I disabled all plugins, which didn’t help either. I changed the theme. No go. Finally, a week after this started, I just so happened to be looking at my settings and noticed I didn’t have the same URL in the site address and the WordPress address. One had http://www.playingwithdisaster.com and the other had http://playingwithdisaster.com. Unfortunately, I can’t remember which was which now, but that did the trick.

Wordpress and site URL

Follow up on WordPress security plugins post

I just wanted to write a quick follow up to the blog I wrote last week about a few plugins I was using for WordPress security in light of the global WordPress brute force attacks taking place . The good news is the Wordfence plugin does a great job blocking people trying to login to my site. The bad news is either the Stealth Login Page plugin doesn’t work or some how people are easily guessing my question and answer phrase to get to my login page, which seems hard to believe. I’m thinking there must be some other way to by pass it.

Because of this, I first removed the Stealth Login page and installed AskApache Password Protect. This requires you to create a separate user account and utilizes .htaccess to secure wp-admin and wp-login.php. When you attempt to login to the WordPress admin page, you are prompted by your web browser for one login. Then if you enter that properly, you are prompted for the normal WordPress login. There are other security features to the AskApache plugin, but I quickly broke my site trying them out, so I won’t touch on them.

This seemed to be a good option until I saw a post from Matt Hartley on Google+ mentioning a two factor authentication option for WordPress. That plugin is put out by Duo Security and it sends you an SMS text after you login for the second phase of authentication to your WordPress blog. You can configure it to remember your computer for a specific period of time, so you won’t have to do this every time you login.

The plugin was fairly simple to setup, and so far it seems to work great. The service is free for up to 10 users. If you want to set it up, you can find instructions here.

A couple WordPress security plugins

First, let me say I am no WordPress expert. I can set it up and make my way around it to do the things I want to do, like this blog and my other blog playingwithpython.com. Being a network/systems guy, I’m always worried about security. With WordPress there are a few concerns I had that are nicely addressed by a couple plugins that I think everyone should have.

1.  Many sites are used to spread malware without even knowing it. To protect against this, you can use WordPress File Monitor Plus. This plugin scans your site for changed files and alerts you when something has been altered. You can then clear the alert if it is OK, or take action to correct your site. Another plugin Wordfence keeps a copy of every WordPress version and every theme on their servers, and they scan your installation comparing it against their database to see if any files have been changed or tampered with. If you alter a file, you can tell it to ignore that change until it changes again. They also scan for many of the known malware.

2.  Unlimited login attempts. By default, WordPress allows unlimited login attempts, so anyone can sit there and pluck away trying to get into your site. Hopefully, you have a strong password, but if you have multiple users, do you know for sure everyone does? Also, if there are no limits on logins, it might not matter how good your password is if a hacker has unlimited attempts to figure it out. To address this, you can load the plugin Limit Login Attempts or Wordfence. Both have settings where you can specify how many bad attempts are made before an account is locked. Both have minor differences in the options, but both are much better than allowing someone to keep trying to get into your site.

3.  Lastly, it’s probably worth changing the default wp-admin login page. This may not seem like a big issue, but it’s just another layer to avoid someone possibly login into your site. I found a few pages showing how to do this by editing .htaccess, wp-config.php, etc, but that seems like a bit much for something that should be fairly simple, not to mention I couldn’t get it to work (wawawawa). Instead I opted for the plugin, Stealth Login Page. This plugin lets you mask your wp-admin login page. You specify a url to redirect users who attempt to access http://yoursite/wp-admin. For instance, you can redirect them back to your main page. After that, you specify a question and an answer. This will make up the url you will use to actually get to the login page. For example, if your question is “whoami” and the answer is “nobody”, you’re login page would be http://yoursite/wp-login.php?whoami=nobody.

As you can see these are just a few low hanging fruits in the security picture, but I think they’d help secure your site fairly well. Wordfence does a lot more than what is mentioned here, including scanning your site for various vulnerabilities. By using number 2 and 3 together, you not only force someone to guess your password, but they’d also have to guess your question and answer.

If you have any other solutions or WordPress security concerns, I’d be interested in hearing them in the comments.