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.
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.
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
- Access your WordPress files via your hosting control panel File Manager or an FTP client.
- Locate and back up the
wp-config.phpfile. - Edit
wp-config.phpand add the WordPress site URL constants to force the correct address. - Check the
.htaccessfile for hardcoded redirect rules. - Save your changes and clear your browser cache.
- Attempt to log in to your WordPress dashboard again.
- 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
- Click the three-dot menu in the top-right corner.
- Select Settings, then Privacy and security.
- Click Clear browsing data.
- Select Cached images and files and click Clear data.
Mozilla Firefox
- Click the menu button (three horizontal lines) and select Settings.
- Go to Privacy & Security.
- Scroll to Cookies and Site Data and click Clear Data.
- Check Cached Web Content and click Clear.
Microsoft Edge
- Click the three-dot menu and select Settings.
- Choose Privacy, search, and services.
- Under Clear browsing data, click Choose what to clear.
- Select Cached images and files and click Clear now.
Apple Safari
- Click Safari in the top menu bar and select Settings (or Preferences).
- Go to the Privacy tab.
- Click Manage Website Data, then Remove All.
- 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
- Check that your domain's A record and CNAME record are pointing to the correct IP address for your new hosting server.
- Ensure DNS propagation has completed. Changes to domain records can take up to 48 hours to update globally, though they are often faster within Australia.
- Disable any caching plugins by renaming their folder in
wp-content/pluginsvia your file manager. - Clear any server-side caching enabled within your hosting control panel.
- Update the siteurl and home options directly in the WordPress database via phpMyAdmin in your hosting control panel.
If you continue to experience login issues after following these steps, Open a Ticket for further assistance.
Still Having Issues?
💻 Open a Ticket