admin管理员组

文章数量:1252691

I have a WordPress website on a Digital Ocean VPS which I've come back to and tried to log into the admin panel through the 'wp-admin' link. For some reason I can't access it now. The website gets redirected to 'http://%24domain/wp-admin/' which is a broken link.

Here are the current things that I have tried but nothing has worked so far:

  • Renaming the plugins directory so they appear deactivated

  • Adding the following two lines to wp-config.php: define('WP_SITEURL', ''); define('WP_HOME', '');

  • Keeping the theme/plugin files but re-uploading the core WordPress files

  • Changing some options values (but adding a custom script which requires wp-load.php): update_option('siteurl', '' ); update_option('home', '' );

  • Deleting the .htaccess in the root directory

None of these have worked and I have no idea why the admin panel can't be accessed and redirects to that domain.

Can someone help me get the admin panel working again? Any help is much appreciated!

I have a WordPress website on a Digital Ocean VPS which I've come back to and tried to log into the admin panel through the 'wp-admin' link. For some reason I can't access it now. The website gets redirected to 'http://%24domain/wp-admin/' which is a broken link.

Here are the current things that I have tried but nothing has worked so far:

  • Renaming the plugins directory so they appear deactivated

  • Adding the following two lines to wp-config.php: define('WP_SITEURL', 'http://example'); define('WP_HOME', 'http://example');

  • Keeping the theme/plugin files but re-uploading the core WordPress files

  • Changing some options values (but adding a custom script which requires wp-load.php): update_option('siteurl', 'http://example' ); update_option('home', 'http://example' );

  • Deleting the .htaccess in the root directory

None of these have worked and I have no idea why the admin panel can't be accessed and redirects to that domain.

Can someone help me get the admin panel working again? Any help is much appreciated!

Share Improve this question asked May 13, 2019 at 20:01 thairishthairish 2131 gold badge3 silver badges8 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 1

first of all you shouldnt delete .htaccess file. create another one in the root directory and add following lines to it:

# 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

then go to wp-config.php and add these lines:

define( 'WP_HOME', 'http://youresite' );
define( 'WP_SITEURL', 'http://youresite' );

now go to wp-admin and hopefully youre redirect problem will be fixed.
dont forget to remove last code from wp-config after fixing youre issue.

I fixed this by going to this link in the browser:

http://example/wp-admin/install.php

Replace example with your website. You will see a login button and then you can enter your credentials to log in to your WordPress dashboard.

The other answer is a good start. Although I prefer to change the two URLs in the wp-options table, which is read first on all page loads (and is indicated as the preferred method in the Codex).

See this entry in the Codex https://codex.wordpress/Changing_The_Site_URL where it says:

This is not necessarily the best fix, it's just hardcoding the values into the site itself. You won't be able to edit them on the General settings page anymore when using this method [setting values in wp-config.php, emphasis added].

So, although changing the values in wp-config.php will work (and is often stated as an 'answer'), I think that the more correct way is to set the proper URLs in the wp-options table.

本文标签: Can39t access wpadminredirects to http24domainwpadmin