WordPress gives me 404 pages not found for all pages except the main page

Suddenly I go to a WordPress site and all the pages give me 404 pages that were not found. I guess the problem is the permalink structure, which I could swear I didn’t touch. The permalink is set to "month and name".

I have investigated similar cases of this problem on the Internet, and much of this is related to the .htaccess file? I tried to find, but I can’t. Maybe he somehow retired? Where should it be located.

Any suggestions would be helpful.

and of course I see hidden files.

+93
wordpress
Mar 03 '11 at 15:07
source share
21 answers

.htaccess is a hidden file, so you must set all files as visible on your ftp.

I suggest you return the default permalink structure (? P = ID) so that you guarantee that the .htaccess problem.

After that, you can simply set the month and name structure again and see if it works.

PS: Have you upgraded to 3.1? In this case, I saw some people with plugin problems.

+87
Mar 03 2018-11-11T00:
source share

Fixing this problem is very simple if you used permalinks other than default , such as Day and name , Month and name , Numeric , Post name or Custom Structure , you only need

Log in to your admin area: Settings > Permalinks , which should be: http://yoursite.com/wp-admin/options-permalink.php

Select the default constant binding option , then save the changes

Then you can return it again to your other previous default selection or save it as default as yo wish

Please note that this problem may occur when moving your site from a domain or location to another.

+45
Sep 27 '13 at 19:59 on
source share

Basically the .htaccess file should exist and httpd.conf should be correct.

In my case, I changed the file /etc/httpd/conf/httpd.conf in the section:

 <Directory "/var/www/html"> 

Line changed:

 AllowOverride None 

to

 AllowOverride All 

And restart the web server.

+37
Sep 09 '16 at 4:52
source share

If the default behavior ( example.com/?p=42 ) works, you should:

  • Change your preferred permalink style: Admin: Settings > Permalinks and click Save. Sometimes this solves the problem. If this is not the case:
  • Make sure the /path/to/wordpress/.htaccess file has been modified and now contains the RewriteEngine On line. If this does not include the string, this is a Wordpress permission issue.
  • Make sure the rewrite module is loaded: create a PHP file with

     <?php phpinfo() ?> 

    in it, open it in a browser and find mod_rewrite . This should be in the "Loaded Modules" section. If this is not the case, turn it on - see the details in the default index.html file of your apache - in Ubuntu you do this with the a2enmod .

  • Make sure the apache server is viewing the .htaccess file. open httpd.conf - or its alternative to Ubuntu, /etc/apache2/apache2.conf . It should be something like

     <Directory /path/to/wordpress> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> 
  • After making these changes, be sure to restart your Apache server. sudo service apache2 restart

+19
Jan 30 '17 at 2:06 on
source share

The problem is easy to solve, just follow the instructions below. If you have access to enter the admin panel, just

Go to Settings " Permalinks, and simply click on Save Changes button .

enter image description here

This will update your permalink settings and reset the rewrite rules. In most cases, this solution fixes the WordPress posts 404 error. However, if it does not work for you, you probably need to update the .htaccess file manually.

Log in to your server using FTP and modify the .htaccess file , which is located in the same location as the folders such as / wp-content / and / wp-includes /, just enter the codes below into your .htaccess

 # 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 

Hope this solves the problem.

+13
Nov 30 '17 at 5:10
source share

In the WordPress admin interface, follow these steps:

  • Go to admin settings

  • Click on the default link and select a message name in the radio button.

  • Scroll down and you will see the .htaccess code here.

     <IfModule mod_rewrite.c> RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] </IfModule> 
  • Copy the code and paste it into the .htaccess file.
+9
Mar 14 '14 at 10:24
source share

If all this does not work, your .htaccess is correct, and the permalink trick did not work, you may not have enabled your apache2 rewite mod .

I ran this and my problem was resolved:

  sudo a2enmod rewrite 
+7
Feb 20 '18 at 18:06
source share

This error is caused by disabling the rewrite mode in the apache httpd.conf document, just uncomment it and enjoy seo friendly permalinks

+6
Apr 05 '13 at 22:34
source share
  • Make sure the directory on .htaccess is correct
  • Verify that the "siteurl" and "home" fields are correct.
+3
Mar 04 2018-11-11T00:
source share

If you have FTP access to your account:

First log into your wp-admin and go to Settings> Permalink

You should see something below that says:

"If your .htaccess file is writable, we can do it automatically, but it’s not, these are the mod_rewrite rules that you should have in your .htaccess file. Click in the box and press CTRL + a to select everything."

If so, follow these steps:

  • Go to the settings for your FTP client and make sure that hidden files are displayed (depending on your FTP client). If you do not, you will not be able to find your htaccess file

  • Go to the folder where the directories wp-admin, wp-content, wp-includes are located. Check the .htaccess file. If it exists, go to step 4

  • If this does not exist, create a new empty file in your FTP program called .htaccess

  • Change the chmod for your .htaccess file to 666 (your preference is how you want to do this)

  • Return to the Permalinks page and edit the desired link structure. The problem must be solved!

  • Be sure to change the chmod of the htaccess file to 644 after you are done.

I had the same problem and it looks like she instantly fixed it! Good luck

+2
Oct 12
source share

In most cases, this problem is resolved by simply visiting the Settings → Permalink page in the WordPress admin and click "Save" (as mentioned in several other answers). When this page is available, WordPress overwrites the directives in the .htaccess file, which magically fixes the problem. This problem often occurs after the site is moved (the site breaks because .htaccess is left behind or the settings need to be updated).

If WordPress does not have permission to write the .htaccess file, an inscription will appear at the top of the page and further instructions below when the settings are saved. In this case, you need to edit the .htaccess file yourself or, better, fix the permissions for this file. The file is located in the root directory of the WordPress installation. cd to the directory and sudo chmod 644 .htaccess . You might also want to check if the file belongs to the right group and modify it with chown . Ask your hosting provider if you do not know how to do this.

If you are on shared hosting, probably all you can do. If you still have a problem, you can talk to you about hosting provider support. Otherwise, make sure that .htaccess enabled on the server, as @georgeos already pointed out. Note that httpd.conf not always used ( Ubuntu indicates that it is deprecated , but Apache official docs still say that this is often the main configuration file ). /etc/httpd/conf/httpd.conf and /etc/apache2/apache2.conf seem to be the most common places for this file. Find the block for the shared folder, usually <Directory /var/www/> and make sure that the AllowOverride directive AllowOverride set to All . If it is set to None , your .htaccess file .htaccess simply ignored by the server.

+2
Aug 15 '17 at 23:45
source share

We had the same problem, and we solved it by checking the error.log of our virtual host. We found the following message:

AH00670: FollowSymLinks and SymLinksIfOwnerMatch options are both disabled, so the RewriteRule directive is also forbidden due to its similar ability to bypass directory restrictions: / srv / www / htdocs / wp-intranet /

The solution was to install Options All and AllowOverride All in our virtual host configuration.

+2
Jul 03 '18 at 14:48
source share

I installed mod_rewrite to fix the problem. The link below contains installation instructions: - http://www.iasptk.com/enable-apache-mod_rewrite-ubuntu-14-04-lts/

+1
Jan 11 '17 at 17:58
source share

I have the same problem, so I uninstall Apache and do it again and the problem is resolved.

0
Jun 06 '13 at 16:38
source share

You may have .htaccess disabled in your web hosting settings. In this case, setting default constants will work.

0
Feb 28 '17 at 14:34
source share

Just select Settings-> Permalink in the control panel, and then Save the changes to the latter. \

0
Jul 13 '17 at 10:30
source share

Case 1: - Let’s think if you transfer a site from one hosting to another hosting, if you see this problem.

Solution: - Just go to the old file, copy the .htaccess file to the old server, and then run it on the new .htaccess server. 99% I will work.

0
Nov 07 '17 at 5:05
source share

If your WordPress installation is located in a subfolder (for example, https://www.example.com/subfolder ), change this line in WordPress .htaccess

 RewriteRule . /index.php [L] 

to

 RewriteRule . /subfolder/index.php [L] 

Thus, you tell the server to search for WordPress index.php in the WordPress folder (for example, https://www.example.com/subfolder ) and not in the shared folder (for example, https://www.example.com ).

0
Nov 27 '17 at 17:34
source share

I just changed the permalink to the "month and day" of all posts by going to settings> permalink.

Now all posts are open and working fine.

I again renamed all posts to their actual permalink. Its working fine again.

This method worked for me :-)

0
May 20 '18 at 13:57
source share

For nginx users

Use the following information in the conf file for your site (usually /etc/nginx/sites-available/example.com )

location/{ try_files $uri $uri//index.php?q=$uri&$args; }

This passes all persistent requests to index.php with the URI string and arguments provided. Run systemctl reload nginx to see the changes, and your links not on the home page should load.

0
Jun 14 '18 at 14:24
source share

I had this problem not so long ago. I had reset my permalink to the default value or just its saved, updated themes / kernel to (4.7.4) / plugins, all plugins deactivated, switched to the default theme, optimized database, .htaccess is already by default , checked file permissions, mod_rewrite enabled.

So far, nothing works, what works, messages, new page, EXCEPT page / contact for old pages.

Mostly pages / urls that don't work:

 /breeding /training /training/* /breeding/* 

Ultimate, I found these files in the root folder:

/breeding.php and /training.php

I renamed both the files and the pages I worked on.

-one
May 16 '17 at 16:05
source share



All Articles