How to fix 404 not found for all pages except homepage in WordPress

The error with 404 not found for all pages less hompage is often caused by a configuration that is not well done. But before think about a server issue first check if you have the .htaccess file in your wordpress instalation. To do that you have to connect using FTP, or cpanel -> file manager but be aware of the file si hidden so you will have to find the option for show hidden files. Once you found it open it and make sure it is not empty. If it's you will have to add the following code to your file:

# 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> 

Refresh the website and check if it working.

 

Other methods to fix the 404 issue

If it still not working, go to the admin panel -> Settings -> Permalink settings and select the first option the one where it will add get parameter to the url. Probably the issue will be gone. Doing this we know that is a problem with apache configuration. Move back the permalink settings and open up the terminal because you will have to connect using SSH in order to fix the problem or you can ask your host provider to make sure that rewrite module is active.

If the module is active and it still does not work, open up the terminal and do the following steps (the below steps will work on linux centos, I didn't tested it on other os)

  1. write: cd /etc/httpd/conf
  2. write: nano httpd.conf
  3. find the line <Directory /var/html> in this block change AllowOveride from None to All
  4. write serivce httpd restart - in order the above code to work we will have to restart the apache. This command will to the trick for us.

Now refresh the website and it should work. Let me know if this method has helped you to fix the 404 error.

 

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x