Support » Plugin: Proxy Cache Purge » Too many HTTP redirects on my website, takes time for landing page

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Plugin Review Team Rep

    I noticed that my website when visited via androidsage.com redirects to non-www website which is http://www.androidsage.com (two times) and then that redirects to https://www.androidsage.com.

    That has nothing to do with the plugin as it doesn’t do anything with redirects. The redirects are set (on DreamHost) in two places.

    1) In panel you have the ability to redirect www or not. Make SURE that’s set to www

    2) In your .htaccess you have the ability to redirect – https://help.dreamhost.com/hc/en-us/articles/215747758-How-do-I-force-my-site-to-load-securely-with-an-htaccess-file- has multiple options (pick the one for DreamPress) 🙂

    Either way, even if you disable the plugin, it will have nothing to do with the redirects. Literally all the plugin does is have WP tell the cache when to empty.

    Hi I also have the same problem.

    My site is ionoleggioauto.com

    https://varvy.com/tools/redirects/ tells me there are 19 redirects

    How did you solve it?
    Have you turned off Varnish?

    Hi I have seen through the same tool that I even have 19 redirects.
    My site is ionoleggioauto.com

    I’m trying a thousand ways to solve the problem but there seems to be nothing to do.

    The only thing that appears on cpanel is that the url is set correctly without www.

    How did you solve it?

    Look at Varvy’s tool what me from:

    http://www.ionoleggioauto.com
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/
    https://www.ionoleggioauto.com/
     301 redirect
    https://www.ionoleggioauto.com/

     Final status code: 301

    Check your htaccess code. Get a clean redirect code. If you are on dreamhost hosting, choose the option, leave www and non-www redirect as it is. Also check your cloudflare settings. See if there are any page rules.

    Hi and thanks for your prompt response.

    I kindly ask you to explain the following if you do not mind:

    1 – Did you disable Varnish?
    2 – On Cloudflare, I’ve only enabled SSL in Flexible mode and no other option, but I did not set any rules for the rules.
    3 – Unfortunately I do not have dreamhost. Is it important to put www rather than without www? I always used it without www.

    You put my htaccess, honestly I do not understand much about htaccess. You who are more experienced than me, can you figure out what’s wrong?

    Thank you in advance.

    <FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css|woff)$">
    ExpiresActive On
    ExpiresDefault A2592000
    </FilesMatch>
    <IfModule mod_expires.c>
      ExpiresActive on
    # Perhaps better to whitelist expires rules? Perhaps.
      ExpiresDefault                          "access plus 1 month"
    # Data
      ExpiresByType text/xml                  "access plus 0 seconds"
      ExpiresByType application/xml           "access plus 0 seconds"
      ExpiresByType application/json          "access plus 0 seconds"
    # Favicon (cannot be renamed)
      ExpiresByType image/x-icon              "access plus 1 week"
    # Media: images, video, audio
      ExpiresByType image/gif                 "access plus 1 month"
      ExpiresByType image/png                 "access plus 1 month"
      ExpiresByType image/jpeg                "access plus 1 month"
      ExpiresByType video/ogg                 "access plus 1 month"
      ExpiresByType audio/ogg                 "access plus 1 month"
      ExpiresByType video/mp4                 "access plus 1 month"
      ExpiresByType video/webm                "access plus 1 month"
    # Webfonts
      ExpiresByType application/x-font-ttf    "access plus 1 month"
      ExpiresByType font/opentype             "access plus 1 month"
      ExpiresByType application/x-font-woff   "access plus 1 month"
      ExpiresByType image/svg+xml             "access plus 1 month"
      ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    # CSS and JavaScript
      ExpiresByType text/css                  "access plus 1 year"
      ExpiresByType application/javascript    "access plus 1 year"
    </IfModule>
    Header set Cache-Control "max-age=0, private, no-cache, no-store, must-revalidate" 
    # BEGIN WP Performance Score Booster Settings
    php_value max_input_vars 10000
    ## BEGIN Enable GZIP Compression ##
    <IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/x-httpd-php
    AddOutputFilterByType DEFLATE application/x-httpd-fastphp
    AddOutputFilterByType DEFLATE image/svg+xml
    SetOutputFilter DEFLATE
    </IfModule>
    ## END Enable GZIP Compression ##
    <FilesMatch "!\.(gif|jpe?g|png)$">
    php_value session.cookie_domain ionoleggioauto.com
    </FilesMatch>
    <FilesMatch "wp-login.php">
    Deny from All
    ErrorDocument 403 "Forbidden"
    </FilesMatch>
    ## BEGIN Vary: Accept-Encoding Header ##
    <IfModule mod_headers.c>
    <FilesMatch "\.(js|css|xml|gz)$">
    Header append Vary: Accept-Encoding
    </FilesMatch>
    </IfModule>
    ## END Vary: Accept-Encoding Header ##
    <ifModule mod_headers.c>
    Header unset ETag
    Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires "Mon, 13 jun 2016 20:30:00 GMT"
    </ifModule>
    <IfModule mod_headers.c>
    Header set Connection keep-alive
    Header set Expires "max-age=A2592000, public"
    Header unset ETag
    </IfModule>
    # END WP Performance Score Booster Settings
    # BEGIN W3TC Browser Cache
    <IfModule mod_mime.c>
        AddType text/css .css
        AddType text/x-component .htc
        AddType application/x-javascript .js
        AddType application/javascript .js2
        AddType text/javascript .js3
        AddType text/x-js .js4
        AddType text/html .html .htm
        AddType text/richtext .rtf .rtx
        AddType image/svg+xml .svg
        AddType text/plain .txt
        AddType text/xsd .xsd
        AddType text/xsl .xsl
        AddType text/xml .xml
        AddType video/asf .asf .asx .wax .wmv .wmx
        AddType video/avi .avi
        AddType image/bmp .bmp
        AddType application/java .class
        AddType video/divx .divx
        AddType application/msword .doc .docx
        AddType application/vnd.ms-fontobject .eot
        AddType application/x-msdownload .exe
        AddType image/gif .gif
        AddType application/x-gzip .gz .gzip
        AddType image/x-icon .ico
        AddType image/jpeg .jpg .jpeg .jpe
        AddType image/webp .webp
        AddType application/json .json
        AddType application/vnd.ms-access .mdb
        AddType audio/midi .mid .midi
        AddType video/quicktime .mov .qt
        AddType audio/mpeg .mp3 .m4a
        AddType video/mp4 .mp4 .m4v
        AddType video/mpeg .mpeg .mpg .mpe
        AddType application/vnd.ms-project .mpp
        AddType application/x-font-otf .otf
        AddType application/vnd.ms-opentype ._otf
        AddType application/vnd.oasis.opendocument.database .odb
        AddType application/vnd.oasis.opendocument.chart .odc
        AddType application/vnd.oasis.opendocument.formula .odf
        AddType application/vnd.oasis.opendocument.graphics .odg
        AddType application/vnd.oasis.opendocument.presentation .odp
        AddType application/vnd.oasis.opendocument.spreadsheet .ods
        AddType application/vnd.oasis.opendocument.text .odt
        AddType audio/ogg .ogg
        AddType application/pdf .pdf
        AddType image/png .png
        AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
        AddType audio/x-realaudio .ra .ram
        AddType image/svg+xml .svg .svgz
        AddType application/x-shockwave-flash .swf
        AddType application/x-tar .tar
        AddType image/tiff .tif .tiff
        AddType application/x-font-ttf .ttf .ttc
        AddType application/vnd.ms-opentype ._ttf
        AddType audio/wav .wav
        AddType audio/wma .wma
        AddType application/vnd.ms-write .wri
        AddType application/font-woff .woff
        AddType application/font-woff2 .woff2
        AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
        AddType application/zip .zip
    </IfModule>
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType text/css A31536000
        ExpiresByType text/x-component A31536000
        ExpiresByType application/x-javascript A31536000
        ExpiresByType application/javascript A31536000
        ExpiresByType text/javascript A31536000
        ExpiresByType text/x-js A31536000
        ExpiresByType text/html A3600
        ExpiresByType text/richtext A3600
        ExpiresByType image/svg+xml A3600
        ExpiresByType text/plain A3600
        ExpiresByType text/xsd A3600
        ExpiresByType text/xsl A3600
        ExpiresByType text/xml A3600
        ExpiresByType video/asf A31536000
        ExpiresByType video/avi A31536000
        ExpiresByType image/bmp A31536000
        ExpiresByType application/java A31536000
        ExpiresByType video/divx A31536000
        ExpiresByType application/msword A31536000
        ExpiresByType application/vnd.ms-fontobject A31536000
        ExpiresByType application/x-msdownload A31536000
        ExpiresByType image/gif A31536000
        ExpiresByType application/x-gzip A31536000
        ExpiresByType image/x-icon A31536000
        ExpiresByType image/jpeg A31536000
        ExpiresByType image/webp A31536000
        ExpiresByType application/json A31536000
        ExpiresByType application/vnd.ms-access A31536000
        ExpiresByType audio/midi A31536000
        ExpiresByType video/quicktime A31536000
        ExpiresByType audio/mpeg A31536000
        ExpiresByType video/mp4 A31536000
        ExpiresByType video/mpeg A31536000
        ExpiresByType application/vnd.ms-project A31536000
        ExpiresByType application/x-font-otf A31536000
        ExpiresByType application/vnd.ms-opentype A31536000
        ExpiresByType application/vnd.oasis.opendocument.database A31536000
        ExpiresByType application/vnd.oasis.opendocument.chart A31536000
        ExpiresByType application/vnd.oasis.opendocument.formula A31536000
        ExpiresByType application/vnd.oasis.opendocument.graphics A31536000
        ExpiresByType application/vnd.oasis.opendocument.presentation A31536000
        ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000
        ExpiresByType application/vnd.oasis.opendocument.text A31536000
        ExpiresByType audio/ogg A31536000
        ExpiresByType application/pdf A31536000
        ExpiresByType image/png A31536000
        ExpiresByType application/vnd.ms-powerpoint A31536000
        ExpiresByType audio/x-realaudio A31536000
        ExpiresByType image/svg+xml A31536000
        ExpiresByType application/x-shockwave-flash A31536000
        ExpiresByType application/x-tar A31536000
        ExpiresByType image/tiff A31536000
        ExpiresByType application/x-font-ttf A31536000
        ExpiresByType application/vnd.ms-opentype A31536000
        ExpiresByType audio/wav A31536000
        ExpiresByType audio/wma A31536000
        ExpiresByType application/vnd.ms-write A31536000
        ExpiresByType application/font-woff A31536000
        ExpiresByType application/font-woff2 A31536000
        ExpiresByType application/vnd.ms-excel A31536000
        ExpiresByType application/zip A31536000
    </IfModule>
    <IfModule mod_deflate.c>
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon image/webp application/json application/vnd.ms-access application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.presentation application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf application/vnd.ms-opentype audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel
        <IfModule mod_mime.c>
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        </IfModule>
    </IfModule>
    <FilesMatch "\.(css|htc|less|js|js2|js3|js4|CSS|HTC|LESS|JS|JS2|JS3|JS4)$">
        FileETag MTime Size
        <IfModule mod_headers.c>
            Header set Pragma "public"
            Header append Cache-Control "public"
             Header set X-Powered-By "W3 Total Cache/0.9.5.4"
        </IfModule>
    </FilesMatch>
    <FilesMatch "\.(html|htm|rtf|rtx|svg|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|TXT|XSD|XSL|XML)$">
        FileETag MTime Size
        <IfModule mod_headers.c>
            Header append Vary User-Agent env=!dont-vary
            Header set Pragma "public"
            Header append Cache-Control "public"
             Header set X-Powered-By "W3 Total Cache/0.9.5.4"
        </IfModule>
    </FilesMatch>
    <FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|webp|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|_ttf|wav|wma|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|WEBP|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|_TTF|WAV|WMA|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
        FileETag MTime Size
        <IfModule mod_headers.c>
            Header set Pragma "public"
            Header append Cache-Control "public"
             Header set X-Powered-By "W3 Total Cache/0.9.5.4"
        </IfModule>
    </FilesMatch>
    <FilesMatch "\.(bmp|class|doc|docx|eot|exe|ico|webp|json|mdb|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|pot|pps|ppt|pptx|svg|svgz|swf|tif|tiff|ttf|ttc|_ttf|wav|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|BMP|CLASS|DOC|DOCX|EOT|EXE|ICO|WEBP|JSON|MDB|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|POT|PPS|PPT|PPTX|SVG|SVGZ|SWF|TIF|TIFF|TTF|TTC|_TTF|WAV|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW)$">
        <IfModule mod_headers.c>
             Header unset Last-Modified
        </IfModule>
    </FilesMatch>
    # END W3TC Browser Cache
    # BEGIN W3TC Page Cache core
    <IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /
        RewriteCond %{HTTPS} =on
        RewriteRule .* - [E=W3TC_SSL:_ssl]
        RewriteCond %{SERVER_PORT} =443
        RewriteRule .* - [E=W3TC_SSL:_ssl]
        RewriteCond %{HTTP:Accept-Encoding} gzip
        RewriteRule .* - [E=W3TC_ENC:_gzip]
        RewriteCond %{HTTP_COOKIE} w3tc_preview [NC]
        RewriteRule .* - [E=W3TC_PREVIEW:_preview]
        RewriteCond %{REQUEST_METHOD} !=POST
        RewriteCond %{QUERY_STRING} =""
        RewriteCond %{REQUEST_URI} \/$
        RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle) [NC]
        RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -F
        RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
    </IfModule>
    # END W3TC Page Cache core
    # BEGIN W3TC FeedBurner
    <IfModule mod_rewrite.c>
        RewriteCond %{HTTP_USER_AGENT} FeedBurner
        RewriteRule ^wp-content/uploads/([0-9]+)/([0-9]+)/hotlink-ok/(.*)$ /wp-content/uploads/$1/$2/$3 [L]
    </IfModule>
    # END W3TC FeedBurner
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    </IfModule>
    
    # BEGIN rlrssslReallySimpleSSL rsssl_version[2.5.17]
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    </IfModule>
    # END rlrssslReallySimpleSSL
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    # END WordPress
    # WordPress SEO - XML Sitemap Rewrite Fix
    RewriteEngine On
    RewriteBase /
    RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
    RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
    RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
    RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
    RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
    
    # END WordPress SEO - XML Sitemap Rewrite Fix
    

    1-I did not deactivate varnish. It’s still there.
    2- Use Full SSL in cloudflare
    3-If you are using non-www website, then your website is being redirected to www. So choose one and continue using it.

    4-I believe htaccess file is the problem. There’s a lot of conflicting code in it. Too many redirects. Delete the htaccess file or replace it with the default code.

    Here is a sample htaccess code for HTTPS websites:

    # BEGIN rlrssslReallySimpleSSL rsssl_version[2.5.17]
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    </IfModule>
    # END rlrssslReallySimpleSSL
    # 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>
    
    # END WordPress

    Hope this helps. There is also some W3TC caching code in there. So you can remove and install the app again to get the caching. If the above code fails, simply delete htaccess file entirely and it will regenerate again.

    Thanks a lot of my heart, I just had to put Full on Cloudflare, delete the htaccess and update the site page and testing Varvy tool now results in Final status code: 200, although it still reports some sorting.

    I really do not know how to thank you heartily … your help was paramount.

    The only thing I can not understand is because in the Chrome error console when I open this page:

    It tells me there are errors for the javascripts recalled.
    For some I mistake 410.

    But if I plug in the browser, the javascript url makes it look no trouble, for example: https://www.autohost.com/widgetpersiti/noleggionewwindows.js

    Is an encrypted javascript obviously.

    ops
    Forgive me, I’ll rewrite you with the correct url.
    Using google translates and writes what you want.

    Thanks a lot of my heart, I just had to put Full on Cloudflare, delete the htaccess and update the site page and testing Varvy tool now results in Final status code: 200, although it still reports some sorting.

    I really do not know how to thank you heartily … your help was paramount.

    The only thing I can not understand is because in the Chrome error console when I open this page:

    https://www.ionoleggioauto.com/widget-ionoleggioauto-sul-tuo-sito/

    It tells me there are errors for the javascripts recalled.
    For some I mistake 410.

    But if I plug in the browser, the javascript url makes it look no trouble, for example: https://www.ionoleggioauto.com/widgetpersiti/noleggionewwindows.js

    Is an encrypted javascript obviously.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Too many HTTP redirects on my website, takes time for landing page’ is closed to new replies.