Home › Knowledgebase › KB-1145

WordPress Login Redirect Loop After Changing Hosting Providers

Summary

This guide helps you troubleshoot and resolve: WordPress Login Redirect Loop After Changing Hosting Providers. Follow the steps below to fix the issue.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

Common Causes

WordPress Login Redirect Loop After Changing Hosting Providers

After migrating your WordPress website to a new hosting provider, you may encounter a redirect loop when attempting to access your administration dashboard. This typically occurs because the WordPress database still references the previous server's URL, causing the browser to bounce between the old and new addresses without ever loading the login screen. This guide will help you resolve the issue by updating your site address, checking server-side redirect rules, and clearing cached redirects.

Important: Before editing any website files, download a full backup of your website, specifically the wp-config.php file and your WordPress database. Editing core configuration files without a backup can result in site downtime or data loss.

Quick Fix Steps

  1. Access your WordPress files via your hosting control panel File Manager or an FTP client.
  2. Locate and back up the wp-config.php file.
  3. Edit wp-config.php and add the WordPress site URL constants to force the correct address.
  4. Check the .htaccess file for hardcoded redirect rules.
  5. Save your changes and clear your browser cache.
  6. Attempt to log in to your WordPress dashboard again.
  7. Flush your WordPress permalinks once you regain access.

Detailed Instructions

Step 1: Access your website files

Log in to your hosting control panel and open File Manager. Alternatively, connect to your web server using an FTP client such as FileZilla. Navigate to the root directory of your WordPress installation, which is typically named public_html or www.

Step 2: Check your domain registration

If your domain name (e.g., yourbusiness.com.au) is registered with a different provider than your hosting, you must log in to that separate domain registrar account to update your nameservers or DNS records. DNS propagation can take up to 48 hours to update globally, though changes often resolve faster within Australia. During this propagation period, your website may experience intermittent downtime or redirect issues.

Step 3: Edit the wp-config.php file

Locate the file named wp-config.php. Right-click the file and select Edit or Code Edit. Scroll to the bottom of the file, just before the line that reads /* That's all, stop editing! Happy publishing. */.

Step 4: Add the URL constants

Paste the following lines into the file, replacing https://yourdomain.com.au with your actual domain name:

define('WP_HOME','https://yourdomain.com.au');
define('WP_SITEURL','https://yourdomain.com.au');

Click Save to apply the changes.

The WP_HOME and WP_SITEURL constants in wp-config.php override the values stored in your WordPress database. This is exactly why they resolve redirect loops: they force WordPress to use the new address regardless of what is saved in the database options table.

Note: If your website uses an SSL certificate, ensure you use https://. If you do not have SSL installed yet, use http:// temporarily until your certificate is active.

Step 5: Check the .htaccess file for redirect rules

In the same File Manager window, locate the file named .htaccess. If you do not see it, click Settings in the File Manager toolbar and enable Show Hidden Files (dotfiles). Right-click .htaccess and select Edit. Look for any lines containing RewriteRule or Redirect that reference your old domain or old server IP address. Comment out or remove these lines by adding a # symbol at the start of the line, then click Save.

Step 6: Check for hardcoded URLs in the database

If the redirect loop continues, log in to your hosting control panel and open phpMyAdmin. Select your WordPress database from the left-hand menu, then click the SQL tab. Run the following query to search for instances of your old domain:

SELECT * FROM wp_options WHERE option_value LIKE '%your-old-domain.com.au%';

If results appear, edit the option_value field for siteurl and home to reflect your new .com.au domain. Click Go to save the changes.

Step 7: Check security plugins for SSL enforcement

Security plugins such as Wordfence or iThemes Security can enforce SSL or create redirect rules that cause loops after a migration. If you can access your dashboard, navigate to Plugins in the left-hand menu and temporarily deactivate your security plugin. If you cannot access the dashboard, use File Manager to navigate to wp-content/plugins, locate the plugin folder (e.g., wordfence or ithemes-security), and rename it to wordfence-old to disable it.

Step 8: Clear your browser cache

Redirect loops are often cached by your web browser. Use the following steps to ensure you are not loading a cached redirect:

Google Chrome

  1. Click the three-dot menu in the top-right corner.
  2. Select Settings, then Privacy and security.
  3. Click Clear browsing data.
  4. Select Cached images and files and click Clear data.

Mozilla Firefox

  1. Click the menu button (three horizontal lines) and select Settings.
  2. Go to Privacy & Security.
  3. Scroll to Cookies and Site Data and click Clear Data.
  4. Check Cached Web Content and click Clear.

Microsoft Edge

  1. Click the three-dot menu and select Settings.
  2. Choose Privacy, search, and services.
  3. Under Clear browsing data, click Choose what to clear.
  4. Select Cached images and files and click Clear now.

Apple Safari

  1. Click Safari in the top menu bar and select Settings (or Preferences).
  2. Go to the Privacy tab.
  3. Click Manage Website Data, then Remove All.
  4. Alternatively, open a Private Window by pressing Command + Shift + N.

Alternatively, open your website in a private or incognito window to bypass cached redirects entirely.

Step 9: Log in to WordPress

Navigate to your login page, usually located at yourdomain.com.au/wp-admin. Enter your credentials and verify that the dashboard loads correctly without redirecting.

Step 10: Flush your permalinks

Once you have regained access to your dashboard, navigate to Settings and then Permalinks. Click the Save Changes button at the bottom of the page without making any alterations. This flushes your permalink structure and rewrites your .htaccess rules to match your new hosting environment.

Step 11: Update your WordPress settings permanently

Navigate to Settings and then General. Confirm that the WordPress Address (URL) and Site Address (URL) fields match your new domain. You can then remove the constants you added to wp-config.php if you prefer to manage these settings within the dashboard.

Troubleshooting

If the redirect loop persists

If you continue to experience login issues after following these steps, Open a Ticket for further assistance.

Still Having Issues?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket