Redirect Localhost wordpress site to dashboard

It sounds like the site & home URLs are not set correctly.

You can set these in wp-admin from the Settings screen, although it sounds like you may not be able to get in there right now, so a workaround is to do the following:

  1. Edit your wp-config.php file
  2. Search to see if WP_HOME or WP_SITEURL is present in this file
  3. If they are, change the address listed to 'http://localhost/wordpress/'

If WP_HOME and WP_SITEURL aren’t present in your wp-config.php file yet, add the following code to the file (anywhere before the comment that says ‘that’s all, stop editing’):

define('WP_HOME', 'http://localhost/wordpress/');
define('WP_SITEURL', 'http://localhost/wordpress/');

If this is the correct address you’ve installed at, and everything has been moved across correctly, you should then be taken to your login screen when you visit http://localhost/wordpress/wp-admin.

EDIT:

If it’s still not redirecting, let’s check your .htaccess file. I’m fairly sure this shouldn’t be impacting the log-in to wp-admin, but we should correct it nevertheless. Open .htaccess and look for the WordPress section similar to the below, and add wordpress/ where you see it below on the RewriteBase and RewriteRule lines:

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>

# END WordPress

Updating the .htaccess file is another step that needs to be taken when you move a site, but in most cases it will only affect your Permalinks and is taken care of just by clicking Save on the Settings -> Permalink page in wp-admin. Hopefully updating it manually now might help you too…

Leave a Comment