redirected you too many times

5,215

Your redirect loop is typically caused by one or more of:

  • a .htaccess file on your HTPS site that does another redirect back to port 80
  • a Wordpress install that is still configured as http://www.example.com in wp-config.php
  • a Reverse Proxy is used (e.g. CloudFlare) that is configured (by design or mistakenly) for SSL off loading and forwards HTTPS requests over plain http to your Wordpress site.
Share:
5,215

Related videos on Youtube

kashif alvi
Author by

kashif alvi

Updated on September 18, 2022

Comments

  • kashif alvi
    kashif alvi over 1 year

    I have a ubuntu vps and i have setup a wordpress installation on it. Also i have a domains whose nameserver is set to cloudflare's nameserver, all the dns setting are on cloudflare and i also have TLS certificate for domain. And i have installed certificates on my server. I have written redirect command Redirect permanent / https://example.com/ in unsecured virtual host i.e port 80. When i try to access the website it throws an error example.com redirected you too many times.

    The virtual host on 80 is

    <VirtualHost *:80>
         ServerAdmin [email protected]
            ServerName example.com
            ServerAlias www.example.com
            DocumentRoot /var/www/html/example
        Redirect permanent / https://example.com/
      ErrorLog ${APACHE_LOG_DIR}/error.log
      CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    

    and virtual host on port 443 is

    <IfModule mod_ssl.c>
            <VirtualHost *:443>
                    ServerAdmin [email protected]
                    ServerName example.com:443
                    ServerAlias www.example.com
                    DocumentRoot /var/www/html/example
    
                    ErrorLog ${APACHE_LOG_DIR}/error.log
                    CustomLog ${APACHE_LOG_DIR}/access.log combined
    
                   SSLEngine on
    
                   SSLCertificateFile      /etc/ssl/certs/example.com.pem
                   SSLCertificateKeyFile /etc/ssl/private/example.com.key
    
                   <FilesMatch "\.(cgi|shtml|phtml|php)$">
                      SSLOptions +StdEnvVars
                    </FilesMatch>
    
                    <Directory /usr/lib/cgi-bin>
                      SSLOptions +StdEnvVars
                    </Directory>
    
                    BrowserMatch "MSIE [2-6]" \
                            nokeepalive ssl-unclean-shutdown \
                            downgrade-1.0 force-response-1.0
                    # MSIE 7 and newer should be able to use keepalive
                    BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
    
            </VirtualHost>
    </IfModule>
    

    Please could anyone help.

  • kashif alvi
    kashif alvi over 7 years
    Thanks @HBruijn got it resolved. Actually there was a [link](.htaccess) file in the outside the root wordpress directory, i deleted it and it got resolved.