Problema de redirecionamento HTTPS para HTTP no site, admin inacessível

  • Autor Autor PichoLetra
  • Data de início Data de início
Este tópico foi traduzido automaticamente do espanhol. Ver original
P

PichoLetra

Préstamo impago
Kappa
Domainer
Olá, amigos, me deem uma mãozinha! coloquei https no meu site, deu tudo certo na parte da hospedagem, mas agora não me deixa entrar no Admin porque tem muito redirecionamento! e não carrega meudominio:/wp-admin Então me disseram na bana que o problema é do .htaccess, que está redirecionando mal! de https para http, podem me ajudar?

PHP:
# BEGIN WP Rocket v2.9.5
# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset UTF-8
# Force UTF-8 for a number of file formats
<IfModule mod_mime.c>
AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
</IfModule>

# FileETag None is not enough for every server.
<IfModule mod_headers.c>
Header unset ETag
</IfModule>

# Since we’re sending far-future expires, we don’t need ETags for static content.
# developer.yahoo.com/performance/rules.html#etags
FileETag None

<IfModule mod_alias.c>
<FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$">
<IfModule mod_headers.c>
Header set X-Powered-By "WP Rocket/2.9.5"
Header unset Pragma
Header append Cache-Control "public"
Header unset Last-Modified
</IfModule>
</FilesMatch>

<FilesMatch "\.(css|htc|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|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|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">
<IfModule mod_headers.c>
Header unset Pragma
Header append Cache-Control "public"
</IfModule>
</FilesMatch>
</IfModule>

# Expires headers (for better cache control)
<IfModule mod_expires.c>
ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
ExpiresDefault                          "access plus 1 month"

# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
ExpiresByType text/cache-manifest       "access plus 0 seconds"

# Your document html
ExpiresByType text/html                 "access plus 0 seconds"

# Data
ExpiresByType text/xml                  "access plus 0 seconds"
ExpiresByType application/xml           "access plus 0 seconds"
ExpiresByType application/json          "access plus 0 seconds"

# Feed
ExpiresByType application/rss+xml       "access plus 1 hour"
ExpiresByType application/atom+xml      "access plus 1 hour"

# 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"

# HTC files  (css3pie)
ExpiresByType text/x-component          "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 application/x-font-woff2  "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>

# Gzip compression
<IfModule mod_deflate.c>
# Active compression
SetOutputFilter DEFLATE
# Force deflate for mangled headers
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
# Don’t compress images and other uncompressible content
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|rar|zip|exe|flv|mov|wma|mp3|avi|swf|mp?g|mp4|webm|webp)$ no-gzip dont-vary
</IfModule>
</IfModule>

# Compress all output labeled with one of the following MIME-types
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \

		                          application/javascript \

		                          application/json \

		                          application/rss+xml \

		                          application/vnd.ms-fontobject \

		                          application/x-font-ttf \

		                          application/xhtml+xml \

		                          application/xml \

		                          font/opentype \

		                          image/svg+xml \

		                          image/x-icon \

		                          text/css \

		                          text/html \

		                          text/plain \

		                          text/x-component \

		                          text/xml
</IfModule>
<IfModule mod_headers.c>
Header append Vary: Accept-Encoding
</IfModule>
</IfModule>

<IfModule mod_mime.c>
AddType text/html .html_gzip
AddEncoding gzip .html_gzip
</IfModule>
<IfModule mod_setenvif.c>
SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} on [OR]
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* - [E=WPR_SSL:-https]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=WPR_ENC:_gzip]
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP:Cookie} !(wordpress_logged_in_|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_) [NC]
RewriteCond %{REQUEST_URI} !^(/carrito/(.*)|.*/feed/?|/wp-json/(.*))$ [NC]
RewriteCond %{HTTP_USER_AGENT} !^(facebookexternalhit).* [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}.html%{ENV:WPR_ENC}" -f
RewriteRule .* "/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}.html%{ENV:WPR_ENC}" [L]
</IfModule>
# END WP Rocket

Options +FollowSymLinks
Options -Indexes
<IfModule mod_headers.c>
    <FilesMatch "\.(js|css|xml|gz)$">
        Header append Vary Accept-Encoding
    </FilesMatch>
    <FilesMatch "\.(ico|jpe?g|png|gif|swf)$">
        Header set Cache-Control "public"
    </FilesMatch>
    <FilesMatch "\.(css)$">
        Header set Cache-Control "public"
    </FilesMatch>
    <FilesMatch "\.(js)$">
        Header set Cache-Control "private"
    </FilesMatch>
    <FilesMatch "\.(x?html?|php)$">
        Header set Cache-Control "private, must-revalidate"
    </FilesMatch>
</IfModule>
<ifModule mod_headers.c>
    Header set Connection keep-alive
</ifModule>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
    Header set Cache-Control "max-age=290304000, public"
</FilesMatch>
# BEGIN GZIP
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifmodule>
# END GZIP
<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
<FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf)$">
ExpiresDefault "access plus 2 hours"
</FilesMatch>
FileETag none
<ifModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 1 seconds"
  ExpiresByType image/gif "access plus 2592000 seconds"
  ExpiresByType image/jpeg "access plus 2592000 seconds"
  ExpiresByType image/png "access plus 2592000 seconds"
  ExpiresByType text/css "access plus 604800 seconds"
  ExpiresByType text/javascript "access plus 216000 seconds"
  ExpiresByType application/x-javascript "access plus 216000 seconds"
</ifModule>  
# BEGIN WP Roids - DO NOT REMOVE THIS LINE
# Expires headers for older browsers
<IfModule mod_expires.c>
	<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|gz|opentype|otf|ttf|woff|woff2)$">
		ExpiresActive On
		ExpiresDefault "access plus 1 year"
	</FilesMatch>
	<FilesMatch ".(xml|txt)$">
		ExpiresActive On
		ExpiresDefault "access plus 2 days"
	</FilesMatch>
	<FilesMatch ".(html|htm)$">
		ExpiresActive On
		ExpiresDefault "access plus 1 hour"
	</FilesMatch>
</IfModule>
# Headers for newer browsers
<IfModule mod_headers.c>
	Header unset ETag
	FileETag None
	Header set Connection keep-alive
	<FilesMatch "\.(js|css|xml|gz|html|htm)$">
		Header append Vary: Accept-Encoding
	</FilesMatch>
	# 1 year
	<FilesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|js|css|gz|opentype|otf|ttf|woff|woff2)$">
		Header set Cache-Control "max-age=31449600, public"
	</FilesMatch>
	# 2 DAYS
	<FilesMatch ".(xml|txt)$">
		Header set Cache-Control "max-age=172800, public, must-revalidate"
	</FilesMatch>
	# 1 HOUR
	<FilesMatch ".(html|htm)$">
		Header set Cache-Control "max-age=3600, must-revalidate"
	</FilesMatch>
</IfModule>
# Enable GZIP compression
<IfModule mod_deflate.c>
	AddOutputFilterByType DEFLATE application/javascript application/rss+xml application/vnd.ms-fontobject application/x-font application/x-font-opentype application/x-font-otf application/x-font-truetype application/x-font-ttf application/x-javascript application/xhtml+xml application/xml font/opentype font/otf font/ttf font/woff font/woff2 image/svg+xml image/x-icon text/css text/html text/javascript text/plain text/xml
	# Remove GZIP browser bugs (only needed for really old browsers)
	BrowserMatch ^Mozilla/4 gzip-only-text/html
	BrowserMatch ^Mozilla/4\.0[678] no-gzip
	BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
	Header append Vary User-Agent
</IfModule>
# Prevent hotlinking of images
<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /
	RewriteCond %{HTTP_REFERER} !^$
	RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mundodelvago.com [NC]
	RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
</IfModule>
# Serve cache CSS and JS as PHP
<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteRule ^(wp-content/plugins/wp-roids/wp-roids-cache/assets.*)\.(css|js) $1\.php [L]
</IfModule>
# serve cached HTML file
<IfModule mod_rewrite.c>
	RewriteEngine On
	RewriteBase /
	RewriteCond %{REQUEST_URI} !^.*[^/]$
	RewriteCond %{REQUEST_URI} !^.*//.*$
	RewriteCond %{REQUEST_METHOD} !POST
	RewriteCond %{QUERY_STRING} !.*=.*
	RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
	RewriteCond %{DOCUMENT_ROOT}/wp-content/plugins/wp-roids/wp-roids-cache/posts/$1/index.html -f
	RewriteRule ^(.*) "wp-content/plugins/wp-roids/wp-roids-cache/posts/$1/index.html" [L]
</IfModule>
# END WP Roids - DO NOT REMOVE THIS LINE
# BEGIN EWWWIO
# END EWWWIO
<Files 403.shtml>
order allow,deny
allow from all
</Files>
deny from 113.66.41.3
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##
# BEGIN s2Member GZIP exclusions
<IfModule rewrite_module>
	RewriteEngine On
	RewriteBase /
	RewriteCond %{QUERY_STRING} (^|\?|&)s2member_file_download\=.+ [OR]
	RewriteCond %{QUERY_STRING} (^|\?|&)no-gzip\=1
	RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions
# 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
#
User-agent: *
Disallow: /cgi-bin
Disallow: /wp-admin
Disallow: /wp-includes
Disallow: /wp-content/plugins/
Disallow: /wp-content/cache/
Disallow: /wp-content/themes/
Disallow: */trackback/
Disallow: */feed/
Disallow: /*/feed/rss/$
Disallow: /category/*
RewriteEngine on
RewriteCond %{QUERY_STRING} ^([0-9]+)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+)(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^([0-9]+\.[0-9])(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)\?([0-9]+\.[0-9])(.*)$ [NC]
RewriteRule ^(.*)$ http://%{REMOTE_ADDR} [L]
 
Foi útil? Participe da conversa

Com sua conta grátis você pode responder, mandar mensagem privada ao autor e comprar com Saldo retido: o pagamento é liberado quando você recebe o combinado.

Leva 30 segundos · você volta a este tópico ao terminar
Use o Really Simple SSL e isso resolve o problema!
 
Deus, meus olhos....

Apague a última entrada.
 
É a última linha do htaccess
 
É que seu htaccess é realmente um lixo.

Enviado do meu SM-G610M usando Tapatalk
 
PHP:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Usei esse em uma das minhas páginas e funciona perfeito
 
PHP:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Usei esse em uma das minhas páginas e funciona perfeito

Agora não consigo entrar na administração, coloco a senha e nada

- - - Atualizado - - -

É que seu htaccess é realmente um lixo.

Enviado do meu SM-G610M usando Tapatalk

Como faço para eliminar o que não serve?
 
Como faço para eliminar o que não serve?


você testou instalando o plugin sugerido?


PS: wp-rocket.... não é necessário para o seu site, amigo.... você carrega 10 imagens, com sorte, por paginação.
 
Comigo aconteceu a mesma coisa, vou ficar atento para ver se você consegue resolver, eu não consegui :s:s
 
Olá,

Eu adicionei este, se você não tem certeza sobre o .htaccess, desative o WP Rocket e elimine a config dele do htaccess momentaneamente enquanto faz a mudança e depois ative o plugin de novo e configure.
HTML:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://TUSITIO.COM/$1 [R=301,L]

Eu te recomendaria reverter o que você fez e se guiar por este tutorial Certificados SSL grátis para proteger seu site com HTTPS - Let's Encrypt

E se você quiser mudar todas as url do BD e o plugin que te mencionaram não funcionar, guie-se por este Mudar URL no WordPress - nerion - nerion

Se quiser deixar seu htaccess no padrão, aqui está.
HTML:
<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

Abraços
 
Última edição:
estranho, com o really ssl quase sempre é a solução
 
Olá,

Eu adicionei este, se você não tem certeza sobre o .htaccess, desative o WP Rocket e elimine a config dele do htaccess momentaneamente enquanto faz a mudança e depois ative o plugin de novo e configure.
HTML:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://TUSITIO.COM/$1 [R=301,L]

Eu te recomendaria reverter o que você fez e se guiar por este tutorial Certificados SSL grátis para proteger seu site com HTTPS - Let's Encrypt

E se você quiser mudar todas as url do BD e o plugin que te mencionaram não funcionar, guie-se por este Mudar URL no WordPress - nerion - nerion

Se quiser deixar seu htaccess no padrão, aqui está.
HTML:
<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

Abraços

Amigo, quando tirei tudo apareceu um erro 404, não carregava os posts
 
Desde que coloquei o https meu site virou uma porcaria, tive que restaurar

Enviado do meu ALE-L23 usando Tapatalk

Bom, pelo menos você fez backup antes, se for implementar o https de novo, sugiro que siga o tutorial que te mencionei. Abraços
 
Bom, pelo menos você fez backup antes, se for implementar o https de novo, sugiro que siga o tutorial que te mencionei. Abraços

Muito obrigado, colega! ele funcionava normal, só que tenho um script em que o https não funciona
 
Voltar
Topo