WordPress is giving me 404 page not found for all

2020-05-11 03:23发布

All of a sudden I go to my WordPress website and all the pages give me a 404 page not found page. I'm assuming the problem lies with the permalink structure, which I could swear I did not touch. The permalink setting is on "month and name."

I've researched similar instances of this problem online and a lot of it has to do with the .htaccess file? I tried finding, but I can't. Perhaps it got deleted somehow? Where is it supposed to be located.

Any suggestions will be helpful

and of course I can see hidden files.

标签: wordpress
22条回答
Animai°情兽
2楼-- · 2020-05-11 04:05

Most of the time this issue is fixed by simply visiting the Settings -> Permalink page in the WordPress admin and click Save (as several other answers already pointed out). When this page is accessed, WordPress rewrites the directives in the .htaccess file which magically fixes the issue. The issue often happens after moving a site (the site breaks because the .htaccess gets left behind or the settings need to be updated).

If WordPress doesn't have the right permissions to write the .htaccess file, a notice will appear at the top of the page and further instructions at the bottom when the settings are saved. In this case you need to edit the .htaccess file yourself or, better, to fix the permissions on that file. The file is at the root of the WordPress installation. cd into the directory and sudo chmod 644 .htaccess. You might also want to check if the file belongs to the right group and change that is needed with chown. Ask your hosting provider if you don't know how to do that.

If you are on shared hosting that's probably all you can do. If you still have the issue you might want to talk to you hosting provider's support. Otherwise, make sure the use of .htaccess files is enabled on the server, as @georgeos already suggested. Note that httpd.conf is not always used (Ubuntu indicates it is deprecated but the official Apache docs still says it 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 public folder, usually <Directory /var/www/> and make sure that the AllowOverride directive is set to All. If it is set to None, your .htaccess file is simply ignored by the server.

查看更多
狗以群分
3楼-- · 2020-05-11 04:05

For nginx users

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

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

This hands off all permalink requests to index.php with a URI string and supplied arguments. Do a systemctl reload nginx to see the changes and your non-homepage links should load.

查看更多
Luminary・发光体
4楼-- · 2020-05-11 04:07

I installed mod_rewrite to fix the issue. Below link provides an installation guide:- http://www.iasptk.com/enable-apache-mod_rewrite-ubuntu-14-04-lts/

查看更多
别忘想泡老子
5楼-- · 2020-05-11 04:09

I had this issue not so long ago. I had reset my permalink to default or just saved it, updated themes/core to (4.7.4)/plugins, deactivated all plugins, switched to default theme, optimized database, .htaccess is already default, checked file permissions, mod_rewrite is on.

So far nothing works, what works are the posts, new page, the /contact page EXCEPT for old pages.

Basically, the pages/URLs that aren't working are:

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

Ultimate, I found these files in the root folder:

/breeding.php and /training.php

I renamed both files and the pages above worked.

查看更多
戒情不戒烟
6楼-- · 2020-05-11 04:10

Just Navigate to Settings->Permalink in your dashboard and then Save Changes button in the last.\

查看更多
霸刀☆藐视天下
7楼-- · 2020-05-11 04:12

You may have .htaccess disallowed in webhost settings. Setting to default permalinks would work in that case.

查看更多
登录 后发表回答