Blog: WordPress
Neon infinity tracer lights

Fix Redirect Loop on WordPress Install

Avatar for John Locke

John Locke is a SEO consultant from Sacramento, CA. He helps manufacturing businesses rank higher through his web agency, Lockedown Design & SEO.

If you need to fix a redirect loop on a fresh install of WordPress, or if you have not_found URLs when trying to reach the admin panel, these steps might solve your problem.

In my scenario, I was manually doing a fresh install of WordPress on a new site, and I was having problems getting the domain name to sync up with the install. The message I was getting was:

The webpage at http://mydomain.com/wp-admin/install.php has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

I was moving a site from a staging server to the live site, for an existing site that I was redesigning. Since I had only recently got the domain name transferred from the original owner, I thought perhaps it was some sort of domain propagation issue. I had already set the TTL (Time To Live) on the DNS records to a low number, so that wasn’t the issue. It turns out that there was no .htaccess file in the root.

After finishing the install, I had another problem. I could see the sample page, but trying to log in to wp-login.php or wp-admin sent me to http://mydomain.com/wp-admin/not_found. Curious.

Adding the following code to the .htaccess fixed all the remaining for issues for me.


# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Let me know if this solves these particular issues for you!

Avatar for John Locke

John Locke is a SEO consultant from Sacramento, CA. He helps manufacturing businesses rank higher through his web agency, Lockedown Design & SEO.

16 comments on “Fix Redirect Loop on WordPress Install

  1. Hi John

    Found this article through Google while trying to solve my problem. I suspected it was something to do with .htaccess and this confirmed it! Now happily working;

    Mat.

  2. Hi John,

    Stumbled on this article in search of a fix, and adding the .htaccess file only resulted in an Internal Server Error (500)
    Any ideas why?

    Thanks.

  3. Hi Ozsaze:

    It’s difficult to say why a 500 status occurred without knowing more specific details. What it does suggest is that the redirect loop you had could be server related and not just related to your install of WordPress.

    I would just remove the changes to the .htaccess and look for the next possible solutions.

  4. Hi

    OK, I have this ‘re-direction to install’ happening and it’s becoming more persistent.

    I’ve Googled my way to possible solutions, and done everything with phpAdmin that I understand/dare do, but it doesn’t seem to offer a permanent solution. There seem to be conflicting ideas out there about the cause, and none of them mention anything about exceeding a certain number of database queries (an original suspect). Potential solutions seem to relate to the following;

    The wp_options table is broken – all I can tell you is that I went through ALL the tables, on ALL the databases, and systematically repaired and optimized them all. I don’t know what else to do and I am nervous about poking around much more than that, anyway.

    Something to do with the .htaccess file that I don’t understand at all. I know what that file is, but not where it is or what to do with it (if anything)

    I do have a couple of questions about the databases that I see. There a multiple db’s (for two different sites), but what’s what? How do I know which databases relate to which parts of the two sites – there seem to be multiple databases associated with each site.

    Thanks,

    Adrian

  5. Hi Adrian:

    Was this on an existing site, or on a freshly installed site? I am getting an install screen for your site.

    If this is a new site, then simply install WordPress again and go from there.

    Your .htaccess is in the root folder. You can only get to it through FTP or something similar. Files that start with a period are usually hidden.

    You should have one database for each install. The database you are using for this site will be the one indicated in your wp-config.php file.

  6. Hi John,
    I got the “ERR_TOO_MANY_REDIRECTS” answer right after trying to install a totally fresh WP.
    Never happened before in my life.
    Any idea?
    Thanx in advance for your help!

  7. Hi Elia:

    I’ve had this happen a few times before. Usually this means there is a redirect loop between the www version of your URL and the non-www version.

    This article has helped me in the past:
    http://www.wpbeginner.com/wp-tutorials/how-to-fix-error-too-many-redirects-issue-in-wordpress/

    Some things you might try:

    Define your home URL in your wp-config.php file. You can do this by adding the following lines (be sure to set www or no www appropriately).

    
    define('WP_HOME','http://example.com');
    define('WP_SITEURL','http://example.com');
    
    

    Make sure your .htaccess file has this block in it. This deals with permalinks, it should be at the top in a fresh install.

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

    If you have caching in place, disable or flush it. Caching can mess with redirects. If by chance there is an old cache folder on the server (as with a migration), try deleting it.

    Make sure cookies are enabled in your browser. If cookies are blocked, this can cause funky stuff to happen.

    Redirect errors always make me tear my hair out, what little I have left. Please let me know if you’re able to resolve your redirection issues.

  8. Hello John. After WordPress installation, I can’t login admin on PC.
    I encounter the redirect loop on browsers like Chrome, IE and Opera. On Firefox, I get this message “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”

    I’ve tried login in from another PC and its still the same thing. What’s strange is that I tried login in from my mobile phone browser and it opened.

    I’m confused. I don’t know what to do.

    Nice blog by the way. Love your design.

  9. Thanks Klem.

    If you can login on mobile, but not PC, it may be a few issues.

    First, I would try clearing your browser cookies. In Chrome this is under the top right menu icon > Settings > Privacy.

    In Firefox, this is under Options > Privacy > Remember History.

    You may also want to see the thread right above with Elia. These are things I try when I encounter the same error.

    You can define the WP_HOME and WP_SITEURL in the wp-config.php file as shown above. This usually helps fix the issue.

    Let me know if you’re still stuck after trying these steps.

  10. Thanks, but this fix did nothing for my issue. Have no idea WTF is going wrong with my install (it’s on a different site than listed above). I’m going to just wipe it and reinstall with a different FTP client. This will be the 3rd time. Hopefully, it’s the charm. :/

Join the Conversation

Your email address will be kept private. Required fields marked *.