The “Too many redirects” error on WordPress is often related to issues with the site’s URL settings, conflicts with plugins, or server misconfigurations. Here are some steps you can take to fix this issue:

1. Check Site URL and Home URL

Ensure that your site URL and home URL are set correctly in WordPress. You can do this via the wp-config.php file or the WordPress dashboard.

  • Via wp-config.php: Add these lines to your wp-config.php file, replacing yourdomain.com with the correct URL for your site: define('WP_HOME', 'https://mosque.learncodeweb.com'); define('WP_SITEURL', 'https://mosque.learncodeweb.com'); This will force WordPress to use the correct URL.
  • Via Database (phpMyAdmin): You can also check and update the URLs directly in the database:
    • Go to phpMyAdmin (or your hosting database management tool).
    • Select your WordPress database.
    • Look for the wp_options table (or with a prefix if you use a custom one, like wp_).
    • Edit the siteurl and home fields to https://mosque.learncodeweb.com.

2. Clear Browser Cache and Cookies

Sometimes, a cached version of the site can cause this issue. Clear your browser cache and cookies and then try accessing the site again.

3. Disable Plugins and Themes

  • Via FTP: Sometimes plugins or themes cause conflicts leading to redirects. To rule this out:
    • Connect to your site using FTP or cPanel’s file manager.
    • Go to wp-content and rename the plugins folder (e.g., to plugins_old).
    • Try accessing the site again.
    • If you can access the dashboard, a plugin is causing the issue. You can rename the folder back to plugins and disable plugins one by one to identify the culprit.
    Alternatively, you can switch to the default WordPress theme by renaming the active theme’s folder.

4. Check .htaccess File

The .htaccess file might have some incorrect redirect rules. To reset it:

  • Connect to your site via FTP or file manager.
  • Find the .htaccess file in the root of your WordPress installation.
  • Rename the .htaccess file to something like .htaccess_old.
  • Try accessing your site again. If it works, go to Settings > Permalinks in the WordPress dashboard and click “Save Changes” to regenerate a fresh .htaccess file.

5. SSL/HTTPS Conflicts

If you recently added SSL (HTTPS) to your site or moved from HTTP to HTTPS, make sure that the site’s settings reflect that correctly:

  • Make sure both WP_HOME and WP_SITEURL are set to https://mosque.learncodeweb.com.
  • If your server is set to force HTTPS, it can create a redirect loop. You can also check your server’s SSL configuration or disable SSL redirection temporarily.

6. Check for Server-Side Issues

  • If you have access to your server logs, check for any errors related to redirects or HTTP status codes. Your web hosting provider can also assist in identifying server-related issues.

After trying these steps, you should be able to resolve the “Too many redirects” issue. If you’re still facing problems, let me know!