Fixing “Not Found” Pages in WordPress Posts when Uploading Images

In WordPress by Fathi Arfaoui0 CommentsLast Updated: September 15th, 2017

WordPress is the most popular CMS and the best software for blogging and website creation. But, as any software, you can find problems and in today’s’ post, I’ll show you how to fix the problems of nor found 404 pages when you see WordPress permalinks or posts. At the same time, you’ll fix the problem of a white screen when you upload images to your blog.

When you set the WordPress permalinks to show the post name or other, WordPress should be able to rewrite the URL rules. The software uses the mod_rewrite module of the Apache web server. In many cases, the module is enabled by default and it should be no problem with that.

There are a couple of ways to make the mod rewrite working in WordPress. To do that, you need access to the FTP or your cPanel account.

Reset WordPress permalinks

First, let’s try to rewrite the URL structure from the WordPress admin area. From there, you can see if the problem can be fixed or not. To configure the WordPress permalinks structure, login, and then click on “Settings”. Next, click on “Permalinks”.

WordPress posts returning 404 errors

Now, after selecting the post name, for example, save the changes.

WordPress Permalink

Enabling mod_rewrite on Apache

If you’ve access to executing code, then, add the following code if you’re using Ubuntu. It will enable mod_rewrite on Apache servers.

sudo a2enmod rewrite

Next, restart Apache to make apply the changes. To restart Apache, execute the next line of code.

sudo service apache2 restart

Next, comes back to WordPress and set the permalinks to the right structure and save the changes. Then, the software will generate the new URL structure for posts and images.

Please make sure to delete your web browser cache before clicking your post link again. Your browser may save a copy of the same page, and it can return the same 404 “not found” page, again. If you can purge your WordPress cache, then, do it.

If you sill see the same “not found” pages and you can’t upload any image to WordPress, then, follow the next solution.

mod_rewrite rule with .htaccess

This is another great solution, but first, you need to access your server files. You can do that with cPanel or with an FTP client Like Filezilla. If you’re using a VPS, then, you can CyberDuck. It’s a great FTP software that works with a secure connection.

In cPanel, for example, find “File Manager” and click on my as the following screenshot.

using cpanel file manager

Next, you’ll see all your WordPress files and directories, there you need to find the file named “.htaccess”. Select and click the edit option from the top menu. Then, you can see the file content in a new window. From there add the following code and save the page.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Enable rewrite rule with file permissions

If none of the above solutions worked, try this one. Logging to cPanel or your FTP software and locate the same “.htaccess” we talked about. You need to turn the file permissions to 666 in order to let the software, edit that file and apply the changes.

Select the file, and then, click the change permissions option from the top menu.

file permissions

When you do that, you’ll get a pop-up window. From there, select the boxes until you see 666 as file permissions. That means the file can be edited by the software.

Finally, save the changes, and test your post again. If you see that the post URL structure has been changed and working, that’s great. But also, upload a new image to WordPress, and see if you can upload it normally. If that’s the case, then, you’ve solved the problem.

If you still have the same problem, then, I recommend contacting your web host or get a high-quality hosting.

About Fathi Arfaoui

Fathi Arfaoui: A Physicist, Blogger, and the founder and owner of Trustiko.com. He shares Business, Blogging, WordPress, Web Safety, and Blogging tips to build better websites and blogs. Also, he shares online marketing strategies and recommendations.

Leave a Comment