• Resolved remiCs

    (@emersong20)


    Hello!

    I’m with some trouble with Litespeed Cache + AMP for WP (https://br.wordpress.org/plugins/accelerated-mobile-pages/)
    Litespeed Cache plugin version: 3.2.3.2
    AMP for WP version: 1.0.54.1

    The problem that happens when the AMP for WP (plugin) redirects the user that is using a mobile phone automatically for the amp website version.
    For instance, if the user visits: https://example.com/article >> https://example.com/article/amp

    The first time that I clear the cache everything works out, but after a while, stop work.
    And I need to clear cache often to try “to solve” this problem.

    I’m tried to follow instructions here: https://www.litespeedtech.com/support/forum/threads/litespeed-cache-conflicting-with-the-amp.15904/

    But everything is okay. I’m sending a copy of my .htaccess file as well.
    I need to know some instructions about how I can debug it.

    # BEGIN iThemes Security - Do not modify or remove this line
    # iThemes Security Config Details: 2
    	# Ban Hosts - Security > Settings > Banned Users
    	SetEnvIF REMOTE_ADDR "^127\.0\.0\.1$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^127\.0\.0\.1$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^127\.0\.0\.1$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^108\.179\.219\.74$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^108\.179\.219\.74$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^108\.179\.219\.74$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^128\.199\.133\.114$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^128\.199\.133\.114$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^128\.199\.133\.114$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^125\.6\.129\.172$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^125\.6\.129\.172$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^125\.6\.129\.172$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^216\.10\.245\.209$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^216\.10\.245\.209$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^216\.10\.245\.209$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^92\.42\.108\.166$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^92\.42\.108\.166$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^92\.42\.108\.166$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^182\.92\.168\.140$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^182\.92\.168\.140$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^182\.92\.168\.140$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^157\.245\.185\.98$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^157\.245\.185\.98$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^157\.245\.185\.98$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^195\.154\.26\.37$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^195\.154\.26\.37$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^195\.154\.26\.37$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^37\.59\.8\.84$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^37\.59\.8\.84$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^37\.59\.8\.84$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^41\.76\.109\.20$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^41\.76\.109\.20$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^41\.76\.109\.20$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^107\.190\.137\.168$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^107\.190\.137\.168$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^107\.190\.137\.168$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^149\.56\.16\.106$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^149\.56\.16\.106$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^149\.56\.16\.106$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^178\.137\.16\.56$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^178\.137\.16\.56$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^178\.137\.16\.56$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^89\.35\.39\.60$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^89\.35\.39\.60$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^89\.35\.39\.60$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^185\.234\.218\.33$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^185\.234\.218\.33$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^185\.234\.218\.33$" DenyAccess
    
    	SetEnvIF REMOTE_ADDR "^95\.173\.182\.29$" DenyAccess
    	SetEnvIF X-FORWARDED-FOR "^95\.173\.182\.29$" DenyAccess
    	SetEnvIF X-CLUSTER-CLIENT-IP "^95\.173\.182\.29$" DenyAccess
    
    	<IfModule mod_litespeed.c>
    		Order allow,deny
    		Allow from all
    		Deny from env=DenyAccess
    		Deny from 127.0.0.1
    		Deny from 108.179.219.74
    		Deny from 128.199.133.114
    		Deny from 125.6.129.172
    		Deny from 216.10.245.209
    		Deny from 92.42.108.166
    		Deny from 182.92.168.140
    		Deny from 157.245.185.98
    		Deny from 195.154.26.37
    		Deny from 37.59.8.84
    		Deny from 41.76.109.20
    		Deny from 107.190.137.168
    		Deny from 149.56.16.106
    		Deny from 178.137.16.56
    		Deny from 89.35.39.60
    		Deny from 185.234.218.33
    		Deny from 95.173.182.29
    	</IfModule>
    
    	# Disable XML-RPC - Security > Settings > WordPress Tweaks > XML-RPC
    	<files xmlrpc.php>
    		<IfModule mod_litespeed.c>
    			Order allow,deny
    			Deny from all
    		</IfModule>
    	</files>
    # END iThemes Security - Do not modify or remove this line
    
    # Created by Redirection
    # Thu, 16 Apr 2020 15:46:41 +0000
    # Redirection 4.7.1 - https://redirection.me
    
    <IfModule mod_rewrite.c>
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
    RewriteRule ^2017/01/23/lista-de-fornecedores-roupas-calcados-celulares-e-bolsas/$ https://fornecedorderoupa.com.br/lista-de-fornecedores-roupas-calcados-celulares-e-bolsas/ [R=301,L]
    RewriteRule ^fornecedores-de-moda-fitness/$ /fornecedores-de-moda-fitness-atacado/ [R=301,L]
    RewriteRule ^2016/09/14/fabricas-de-roupas-em-caruaru/$ https://fornecedorderoupa.com.br/fabricas-de-roupas-em-caruaru/ [R=301,L]
    RewriteRule ^2018/06/05/distribuidores-de-roupas-no-atacado-para-loja-de-10-reais/$ https://fornecedorderoupa.com.br/distribuidores-de-roupas-no-atacado-para-loja-de-10-reais/ [R=301,L]
    RewriteRule ^2017/11/15/polos-de-confeccoes-no-brasil/$ https://fornecedorderoupa.com.br/polos-de-confeccoes-no-brasil/ [R=301,L]
    RewriteRule ^2018/04/24/3-dicas-sobre-como-vender-roupas-sem-sair-de-casa/$ https://fornecedorderoupa.com.br/3-dicas-sobre-como-vender-roupas-sem-sair-de-casa/ [R=301,L]
    RewriteRule ^roupas-no-atacado-vamos-ganhar-dinheiro/$ /roupas-no-atacado-para-revender-e-ganhar-dinheiro/ [R=301,L]
    RewriteRule ^2017/08/30/fabricas-de-calcados-em-nova-serrana/$ https://fornecedorderoupa.com.br/fabricas-de-calcados-em-nova-serrana/ [R=301,L]
    RewriteRule ^2018/04/19/fabrica-de-calcados-femininos-veja-aqui-o-segredo/$ https://fornecedorderoupa.com.br/fabrica-de-calcados-femininos-veja-aqui-o-segredo/ [R=301,L]
    RewriteRule ^melhor-lugar-para-comprar-rasteirinhas-online/$ /melhores-lugares-para-comprar-rasteirinhas-online/ [R=301,L]
    RewriteRule ^atacado-de-roupas-baratas-para-revender/$ /onde-comprar-roupas-online/ [R=301,L]
    RewriteRule ^onde-comprar-shorts-jeans-no-atacado/$ /melhor-lugar-para-comprar-shorts-jeans-feminino/ [R=301,L]
    RewriteRule ^roupas-infantis-em-caruaru-no-atacado/$ /comprar-roupas-infantil-online/ [R=301,L]
    RewriteRule ^fabricantes-para-comprar-roupas-online-e-ganhar-dinheiro/$ /onde-comprar-roupas-online-invista-e-ganhe-dinheiro/ [R=301,L]
    RewriteRule ^fornecedores-de-roupas-importadas-2/$ /onde-encontrar-fornecedores-de-roupas-importadas/ [R=301,L]
    </IfModule>
    
    # End of Redirection
    
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/(?:\ Ballot169)?
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteRule (.*) https://%{HTTP_HOST}/%{REQUEST_URI} [R,L] 
    
    # RewriteRule ^[0-9]+/[0-9]+/(.*)$ https://fornecedorderoupa.com.br/$1 [NC,L,R]
    # RedirectMatch rule 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/([^/]+)$ https://fornecedorderoupa.com.br/$4
    RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/(.*)$ https://fornecedorderoupa.com.br/$3
    
    # BEGIN LSCACHE
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    <IfModule LiteSpeed>
    RewriteEngine on
    CacheLookup on
    RewriteRule .* - [E=Cache-Control:no-autoflush]
    
    ### marker MOBILE start ###
    RewriteCond %{HTTP_USER_AGENT} Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi [NC]
    RewriteRule .* - [E=Cache-Control:vary=ismobile]
    ### marker MOBILE end ###
    
    ### marker CACHE RESOURCE start ###
    RewriteRule wp-content/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php - [E=cache-control:max-age=3600]
    ### marker CACHE RESOURCE end ###
    
    ### marker LOGIN COOKIE start ###
    RewriteRule .? - [E="Cache-Vary:wp-postpass_f828c6682d13ba2fe7396b894702046e"]
    ### marker LOGIN COOKIE end ###
    
    ### marker FAVICON start ###
    RewriteRule favicon\.ico$ - [E=cache-control:max-age=86400]
    ### marker FAVICON end ###
    
    ### marker WEBP start ###
    RewriteCond %{HTTP_ACCEPT} "image/webp" [or]
    RewriteCond %{HTTP_USER_AGENT} "Page Speed"
    RewriteRule .* - [E=Cache-Control:vary=%{ENV:LSCACHE_VARY_VALUE}+webp]
    ### marker WEBP end ###
    
    ### marker DROPQS start ###
    CacheKeyModify -qs:fbclid
    CacheKeyModify -qs:gclid
    CacheKeyModify -qs:utm*
    CacheKeyModify -qs:_ga
    ### marker DROPQS end ###
    
    </IfModule>
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    # END LSCACHE
    # BEGIN NON_LSCACHE
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    ## LITESPEED WP CACHE PLUGIN - Do not edit the contents of this block! ##
    # END NON_LSCACHE
    # BEGIN WordPress
    # As diretrizes (linhas) entre <code>BEGIN WordPress</code> e<code>END WordPress</code> são
    # geradas dinamicamente e só devem ser modificadas através de filtros do WordPress.
    # Quaisquer alterações nas diretivas entre esses marcadores serão sobrescritas.
    <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
    Options -Indexes
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    When you see redirection works , what is the http response header you see ? and what is the header you see when redirection not working ?

    Best regards,

    Thread Starter remiCs

    (@emersong20)

    Hello!

    In both of the cases I see:
    x-litespeed-cache: hit

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    You can try add this at top of your htaccess

    RewriteCond %{REQUEST_URI} !amp [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{HTTP_USER_AGENT} iPhone|Mobile [NC]
    RewriteRule (.*)$ https://%{HTTP_HOST}$1/amp/ [L,R=301]

    Best regards,

    Thread Starter remiCs

    (@emersong20)

    There is a small error in the code you sent me.

    RewriteRule (.*)$ https://%{HTTP_HOST}/$1/amp/ [L,R=301]

    I’ll do some more tests and let you know if the problem has been solved.

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    didn’t see that coming , I tested that rule before I posted it to you which works on my test though.

    any way , please keep me posted how it goes.

    Best regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Litespeed cache conflicting with the AMP’ is closed to new replies.