Search for the Article

WordPress localhost site always redirect to localhost dashboard

 



Step by step to fix this issue

1. Wp-config file

  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/'
  4. If WP_HOME and WP_SITEURL aren't present in your wp-config.php file yet, add the following code to the file
define('WP_HOME', 'http://localhost/wordpress/');
define('WP_SITEURL', 'http://localhost/wordpress/');


2. Check .htaccess file


Open .htaccess and look for the Wordpress section similar to the below, and add your-site-name/ where you see it below on the RewriteBase and RewriteRule lines:


# BEGIN WordPress

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

# END WordPress


3.  Open wp-admin of your local website
 
1. After login on site, navigate onto Settings -> Permalink page change the website URL with your local website URL.


4. Add www in the doamin url in domain settting


  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://www.localhost/wordpress/'
  4. If WP_HOME and WP_SITEURL aren't present in your wp-config.php file yet, add the following code to the file
define('WP_HOME', 'http://www.localhost/wordpress/');
define('WP_SITEURL', 'http://www.localhost/wordpress/');



These setups definately solves the issues, if you are still facing this issue , please let me know by sending me mail.