• Hello all. I’m very much a newbie to WordPress, so bear with me.
    A couple of days ago I went to update my site, but I got a 404 error when trying to access/wp-admin/ or /wp-login/. The site continues to operate without any obvious issue, and looking at the cpanel both the wp-admin folder is there with 755 permissions and wp-login.php is there with 644.

    I’ve done some googling before posting here and have tried the following:
    I’ve cleared the cookies and cache from my browser – no change.
    I’ve turned plugins and themes off – this gives a blank screen.
    I’ve turned plugins on, themes off – blank screen
    Plugins off, themes on – 404.
    Tried deleting .htaccess – no change, and a new identical version appears immediately.
    Tried updating the site url in wpconfig – no change
    And finally, in case it was a database issue I’ve added

    define('WP_ALLOW_REPAIR', true);

    to the wpconfig file, then going to /wp-admin/maint/repair.php, but this too returns a 404.

    I’m not sure where else to go from here… other than to bang my head against a brick wall, delete WordPress, reinstall, and start again from scratch!

    Any advice/suggestions would be greatly appreciated.

    Cheers,
    Tom

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Before proceeding please make sure you have a full backup of your website.

    I assumed you tried adding the following in wp-config.php

    define( 'WP_HOME', 'https://scanrailsoc.org.uk' );
    define( 'WP_SITEURL', 'https://scanrailsoc.org.uk' );
    

    Please try turning off all plugins then in a different browser, clear the browser cache, and then visit https://scanrailsoc.org.uk/wp-login.php

    • If you can see the sign in form, then it is likely a plugin that is behind the issue – check if you have any redirection plugins or SEO plugins that have redirections and temporarily disable all 302 redirections

    If you still cannot sign in with the browser cache cleared, then please check your .htaccess file – it would usually look like the following:

    # BEGIN WordPress
    
    <IfModule mod_rewrite.c>
    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]
    </IfModule>
    
    # END WordPress

    If you find any rewrite rule or condition different from above, then please comment them out, save the file and visit the same wp-login.php page above: please clear your browser cache and reload the page, if necessary. Do make a backup of the .htaccess before making any changes.

    If the above steps did not help, then please raise a ticket with your web host.

    Good luck!

    Your WordPress Address URL and Site Address URL appear to be different. So you’re dealing with this problem.

    You can modify it in the wp-config.php file. Simply enter the code provided below.

    define('WP_HOME','https://scanrailsoc.org.uk');     define('WP_SITEURL','https://scanrailsoc.org.uk');
    Thread Starter scanrail

    (@scanrail)

    Thank you both. I’ve had a play tonight and managed to get it to display the login window once – immediately after clearing my cookies and cache in a different browser and modifying .htaccess as suggested by @metamezzo.

    I then entered username and password – and back to square 1 – error page and ‘too many redirects’. Upon opening .htaccess again I found it had rewritten itself to how it was before being edited:

    <FilesMatch ".*\.(phtml|php|PhP|php5|suspected)$"> 
    Order Allow,Deny 
    Deny from all 
    </FilesMatch> 
    <FilesMatch "^(index.php|wp.php|plugin-install.php|mar.php|cong.php|about.php|install.php|xboom.php|mds.php|saiga.php|wp-admin.php|lv.php|content.php|zxl.php|fm.php|wp-booking.php|zeal.php|mar.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>

    So something (I don’t know what) I causing .htaccess to be rewritten in a way that redirects.
    Any suggestions on what to do next? I’m thinking this needs to be a support ticket to my webhost, but would appreciate any other ideas!

    • This reply was modified 2 years, 8 months ago by scanrail.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘wp-login and wp-admin 404 errors’ is closed to new replies.