If you don’t have a 404.php INSIDE your theme folder – WP displays the main (index) page when page not found, without you messing with the htaccess.
If this doesn’t work, put this code into a file named 404.php :
<?php header("Status: 301 Moved Permanently"); header("Location:http://www.xxxxxx.xxx"); ?>
(xxxxxx.xxx is your domain name)
Upload 404.php into /wp-content/themes/classic/ – change “clasic” to your theme name
WordPress Not Found Error after this?
The Cause of a WordPress Not Found Error.Why did this happen in the first place?
This error is most likely due to the fact that you’ve changed your WordPress permalink structure. The settings for your permalink structure are found in your Admin panel, under Settings » Permalinks. Basically, it lets you choose how the URLs of your WordPress site will look.
The default is always the first radio button, which says “http://www.mysite.com/?p=123”. However, if you’re like me – you’d rather have something more search engine friendly like “http://www.mysite.com/category/page” — and you probably selected the last option which says “Custom Structure,” then saved the change. This is where the error occurs.
Here’s the reason why: by default, your .htaccess file is CHMODded to 644: disallowing WordPress to successfully edit it. You’ll even see the message in your admin panel under “Permalinks” that says this:
If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.
It is very easy to look past this message due to the fact that it’s at the bottom of the screen, appearing in italics, and nearly blending in with the box above it. Anyway – in order to successfully change your permalink structure, you would have had to make the permission settings of your .htaccess file more lenient, so that WordPress can be able to write changes within it.
How to Fix the Error ?
Don’t worry, it’s super easy…and quick
To remedy this problem, simply FTP into your website space and right click your .htaccess file. Change the settings or “file attributes” to 666. Go back to your Permalinks page, choose the link structure you want, and save it. Now, it works!
Don’t forget to go back to your FTP space and CHMOD your .htaccess file back to 644 – otherwise, it’s a major security risk!
- Get into your website’s FTP space, and look for the .htaccess file
- Highlight the .htaccess file in your FTP program, and open its CHMOD settings. It’s probably set to 644. Change it to 666.
- Go back into your WordPress site’s admin section, and navigate to Settings » Permalinks.
- Edit the link structure to whatever you originally wanted (I recommend that you use /%category%/%postname%), and then save it. You should no longer see a “grayed out” .htaccess box on this page, saying that the file is not writable.
- Visit any page of your site and confirm that the error no longer happens. If not, congrats!
- Finally, as a security measure, go back to your FTP space and change your .htaccess file back to 644, since you probably will never have to edit it through the WordPress admin panel ever again.