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.
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 andsudo chmod 644 .htaccess
. You might also want to check if the file belongs to the right group and change that is needed withchown
. 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 thathttpd.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 theAllowOverride
directive is set toAll
. If it is set toNone
, your.htaccess
file is simply ignored by the server.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.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/
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:
Ultimate, I found these files in the root folder:
/breeding.php and /training.php
I renamed both files and the pages above worked.
Just Navigate to Settings->Permalink in your dashboard and then Save Changes button in the last.\
You may have .htaccess disallowed in webhost settings. Setting to default permalinks would work in that case.