Problem 301 redirect HTTP->HTTPS
-
Good morning everyone,
I have installed the latest version of Really Simple SSL in WordPress, configured everything and enabled 301 redirection on .htaccess without problems, all entries are green.
The fact is that the redirection from HTTP to HTTPS does not do it for me, if I write http://www.miosito.com in the browser it does not automatically change it to https://www.miosito.com, if instead I write https: //www.mysite.com works!The test gives me everything ok:
#SSL TEST PAGE#
This page is used purely to test for SSL availability.#SERVER-HTTPS-ON# (on)
#LOADBALANCER##SUCCESSFULLY DETECTED SSL#
I’ve already tried removing and reinstalling the plug-in, heard from my hosting but nothing to do, is there anyone who had the same problem as me? who can help me?
Thank you!!!
The page I need help with: [log in to see the link]
-
Hi @caso85,
Can you try enabling the htaccess redirect in settings/ssl/settings?
Thanks for the reply Roger,
If I go on SETTINGS -> SSL -> PROPERTIES then on “Redirection method” I set: “301 redirection .htaccess”.Do you mean this setting?
Yes, that’s the one.
Can I manually edit the .htaccess file? what do you suggest me?
You have already enabled the setting? Then it should be fixed.
If not, please post the contents of your .htaccess file here, so we can check the redirect.
Rogier thanks for your interest!
I actually enabled everything as you indicated but it doesn’t work correctly, if you want to try redirecting to https the site in http version is this -> http://www.danielecasonato.comBelow is my uploaded .htaccess file:
-------------------------------------------- # BEGIN WpFastestCache # Modified Time: 19-11-22 13:01:41 <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # Start WPFC Exclude # End WPFC Exclude # Start_WPFC_Exclude_Admin_Cookie RewriteCond %{HTTP:Cookie} !wordpress_logged_in_[^\=]+\=daniele.casonato # End_WPFC_Exclude_Admin_Cookie RewriteCond %{HTTP_HOST} ^www.danielecasonato.com RewriteCond %{HTTP_USER_AGENT} !(facebookexternalhit|WP_FASTEST_CACHE_CSS_VALIDATOR|Twitterbot|LinkedInBot|WhatsApp|Mediatoolkitbot) RewriteCond %{HTTP_USER_AGENT} !(WP\sFastest\sCache\sPreload(\siPhone\sMobile)?\s*Bot) RewriteCond %{REQUEST_METHOD} !POST RewriteCond %{REQUEST_URI} !(\/){2}$ RewriteCond %{REQUEST_URI} \/$ RewriteCond %{QUERY_STRING} !.+ RewriteCond %{HTTP:Cookie} !comment_author_ RewriteCond %{HTTP:Cookie} !safirmobilswitcher=mobil RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC] RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/all/$1/index.html -f [or] RewriteCond /home/mhd-01/www.danielecasonato.com/htdocs/wp-content/cache/all/$1/index.html -f RewriteRule ^(.*) "/wp-content/cache/all/$1/index.html" [L] </IfModule> <FilesMatch "index\.(html|htm)$"> AddDefaultCharset UTF-8 <ifModule mod_headers.c> FileETag None 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, 29 Oct 1923 20:30:00 GMT" </ifModule> </FilesMatch> # END WpFastestCache # BEGIN GzipWpFastestCache <IfModule mod_deflate.c> AddType x-font/woff .woff AddType x-font/ttf .ttf AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript 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-font-ttf AddOutputFilterByType DEFLATE x-font/ttf AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE font/opentype font/ttf font/eot font/otf </IfModule> # END GzipWpFastestCache # BEGIN LBCWpFastestCache <FilesMatch "\.(webm|ogg|mp4|ico|pdf|flv|avif|jpg|jpeg|png|gif|webp|js|css|swf|x-html|css|xml|js|woff|woff2|otf|ttf|svg|eot)(\.gz)?$"> <IfModule mod_expires.c> AddType application/font-woff2 .woff2 AddType application/x-font-opentype .otf ExpiresActive On ExpiresDefault A0 ExpiresByType video/webm A10368000 ExpiresByType video/ogg A10368000 ExpiresByType video/mp4 A10368000 ExpiresByType image/avif A10368000 ExpiresByType image/webp A10368000 ExpiresByType image/gif A10368000 ExpiresByType image/png A10368000 ExpiresByType image/jpg A10368000 ExpiresByType image/jpeg A10368000 ExpiresByType image/ico A10368000 ExpiresByType image/svg+xml A10368000 ExpiresByType text/css A10368000 ExpiresByType text/javascript A10368000 ExpiresByType application/javascript A10368000 ExpiresByType application/x-javascript A10368000 ExpiresByType application/font-woff2 A10368000 ExpiresByType application/x-font-opentype A10368000 ExpiresByType application/x-font-truetype A10368000 </IfModule> <IfModule mod_headers.c> Header set Expires "max-age=A10368000, public" Header unset ETag Header set Connection keep-alive FileETag None </IfModule> </FilesMatch> # END LBCWpFastestCache # Really Simple SSL Header always set Strict-Transport-Security: "max-age=31536000" env=HTTPS Header always set X-Content-Type-Options "nosniff" Header always set X-XSS-Protection "1; mode=block" Header always set Expect-CT "max-age=7776000, enforce" Header always set Referrer-Policy: "no-referrer-when-downgrade" Header always set Strict-Transport-Security: "max-age=31536000" env=HTTPS Header always set Content-Security-Policy "upgrade-insecure-requests" Header always set X-Frame-Options: "SAMEORIGIN" Header always set Permissions-Policy: "" # END Really Simple SSL # BEGIN # Le direttive (linee) tra <code>BEGIN</code> e <code>END</code> sono # generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress. # Ogni modifica alle direttive tra questi marcatori verrà sovrascritta. # BEGIN LSCACHE # END LSCACHE # BEGIN NON_LSCACHE # END NON_LSCACHE #RewriteEngine On #RewriteCond %{HTTP:X-Forwarded-Proto} !https #RewriteCond %{HTTPS} off #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] # BEGIN TOPHOST SECURITY CONFIG <files wp-config.php> order allow,deny deny from all </files> #Block comment-post, login, xmlrpc form external referer <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} .(wp-login)\.php* RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} !^([^@]*)@@https?://\1/.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule ^(.*)$ http://%{REMOTE_ADDR} [R=301,L] RewriteCond %{REQUEST_URI} .(wp-comments-post)\.php* RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} !^([^@]*)@@https?://\1/.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule ^(.*)$ http://%{REMOTE_ADDR} [R=301,L] RewriteCond %{REQUEST_URI} .(xmlrpc)\.php* RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} !^([^@]*)@@https?://\1/.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule ^(.*)$ http://%{REMOTE_ADDR} [R=301,L] </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^wp-admin/includes/ - [F,L] RewriteRule !^wp-includes/ - [S=3] RewriteRule ^wp-includes/[^/]+\.php$ - [F,L] RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L] RewriteRule ^wp-includes/theme-compat/ - [F,L] </IfModule> <IfModule mod_expires.c> ExpiresActive On AddType image/x-icon .ico ExpiresByType image/jpg "access plus 12 month" ExpiresByType image/jpeg "access plus 12 month" ExpiresByType image/gif "access plus 12 month" ExpiresByType image/png "access plus 12 month" 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 12 month" ExpiresByType application/x-javascript "access plus 2 month" ExpiresByType text/javascript "access plus 2 month" ExpiresByType application/javascript "access plus 2 month" ExpiresByType image/icon "access plus 12 month" ExpiresByType image/ico "access plus 12 month" ExpiresByType application/x-ico "access plus 12 month" ExpiresByType application/ico "access plus 12 month" ExpiresDefault "access 2 days" </IfModule> #blocca la scansione degli autori #RewriteEngine On #RewriteBase / #RewriteCond %{QUERY_STRING} ^author=(\d+) [NC] #RewriteRule .* - [F] <files ~ "^.*\.([Hh][Tt][Aa])"> order allow,deny deny from all satisfy all </files> # END TOPHOST SECURITY CONFIG #Begin Really Simple Security <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache) RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> Options -Indexes #End Really Simple Security # BEGIN WordPress # Le direttive (linee) tra <code>BEGIN WordPress</code> e <code>END WordPress</code> sono # generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress. # Ogni modifica alle direttive tra questi marcatori verrà sovrascritta. <IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress # BEGIN WP-HUMMINGBIRD-CACHING # Le direttive (linee) tra <code>BEGIN WP-HUMMINGBIRD-CACHING</code> e <code>END WP-HUMMINGBIRD-CACHING</code> sono # generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress. # Ogni modifica alle direttive tra questi marcatori verrà sovrascritta. <IfModule mod_expires.c> ExpiresActive On ExpiresDefault A0 <FilesMatch "\.(txt|xml|js)$"> ExpiresDefault A31536000 </FilesMatch> <FilesMatch "\.(css)$"> ExpiresDefault A31536000 </FilesMatch> <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac|eot|ttf|otf|woff|svg)$"> ExpiresDefault A31536000 </FilesMatch> <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$"> ExpiresDefault A31536000 </FilesMatch> </IfModule> <IfModule mod_headers.c> <FilesMatch "\.(txt|xml|js)$"> Header set Cache-Control "max-age=31536000" </FilesMatch> <FilesMatch "\.(css)$"> Header set Cache-Control "max-age=31536000" </FilesMatch> <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac|eot|ttf|otf|woff|svg)$"> Header set Cache-Control "max-age=31536000" </FilesMatch> <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$"> Header set Cache-Control "max-age=31536000" </FilesMatch> </IfModule> # END WP-HUMMINGBIRD-CACHING # Wordfence WAF <Files ".user.ini"> <IfModule mod_authz_core.c> Require all denied </IfModule> <IfModule !mod_authz_core.c> Order deny,allow Deny from all </IfModule> </Files> # END Wordfence WAF # BEGIN FRedirect_ErrorDocument # Le direttive (linee) tra <code>BEGIN FRedirect_ErrorDocument</code> e <code>END FRedirect_ErrorDocument</code> sono # generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress. # Ogni modifica alle direttive tra questi marcatori verrà sovrascritta. ErrorDocument 404 /index.php?error=404 # END FRedirect_ErrorDocument # END # BEGIN LSCACHE # END LSCACHE # BEGIN NON_LSCACHE # END NON_LSCACHE #RewriteEngine On #RewriteCond %{HTTP:X-Forwarded-Proto} !https #RewriteCond %{HTTPS} off #RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] # BEGIN TOPHOST SECURITY CONFIG <files wp-config.php> order allow,deny deny from all </files> #Block comment-post, login, xmlrpc form external referer <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_METHOD} POST RewriteCond %{REQUEST_URI} .(wp-login)\.php* RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} !^([^@]*)@@https?://\1/.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule ^(.*)$ http://%{REMOTE_ADDR} [R=301,L] RewriteCond %{REQUEST_URI} .(wp-comments-post)\.php* RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} !^([^@]*)@@https?://\1/.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule ^(.*)$ http://%{REMOTE_ADDR} [R=301,L] RewriteCond %{REQUEST_URI} .(xmlrpc)\.php* RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} !^([^@]*)@@https?://\1/.* [OR] RewriteCond %{HTTP_USER_AGENT} ^$ RewriteRule ^(.*)$ http://%{REMOTE_ADDR} [R=301,L] </IfModule> <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^wp-admin/includes/ - [F,L] RewriteRule !^wp-includes/ - [S=3] RewriteRule ^wp-includes/[^/]+\.php$ - [F,L] RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L] RewriteRule ^wp-includes/theme-compat/ - [F,L] </IfModule> <IfModule mod_expires.c> ExpiresActive On AddType image/x-icon .ico ExpiresByType image/jpg "access plus 12 month" ExpiresByType image/jpeg "access plus 12 month" ExpiresByType image/gif "access plus 12 month" ExpiresByType image/png "access plus 12 month" 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 12 month" ExpiresByType application/x-javascript "access plus 2 month" ExpiresByType text/javascript "access plus 2 month" ExpiresByType application/javascript "access plus 2 month" ExpiresByType image/icon "access plus 12 month" ExpiresByType image/ico "access plus 12 month" ExpiresByType application/x-ico "access plus 12 month" ExpiresByType application/ico "access plus 12 month" ExpiresDefault "access 2 days" </IfModule> #blocca la scansione degli autori #RewriteEngine On #RewriteBase / #RewriteCond %{QUERY_STRING} ^author=(\d+) [NC] #RewriteRule .* - [F] <files ~ "^.*\.([Hh][Tt][Aa])"> order allow,deny deny from all satisfy all </files> # END TOPHOST SECURITY CONFIG #Begin Really Simple Security <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache) RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> Options -Indexes #End Really Simple Security # BEGIN WordPress # Le direttive (linee) tra <code>BEGIN WordPress</code> e <code>END WordPress</code> sono # generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress. # Ogni modifica alle direttive tra questi marcatori verrà sovrascritta. <IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress # BEGIN WP-HUMMINGBIRD-CACHING # Le direttive (linee) tra <code>BEGIN WP-HUMMINGBIRD-CACHING</code> e <code>END WP-HUMMINGBIRD-CACHING</code> sono # generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress. # Ogni modifica alle direttive tra questi marcatori verrà sovrascritta. <IfModule mod_expires.c> ExpiresActive On ExpiresDefault A0 <FilesMatch "\.(txt|xml|js)$"> ExpiresDefault A31536000 </FilesMatch> <FilesMatch "\.(css)$"> ExpiresDefault A31536000 </FilesMatch> <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac|eot|ttf|otf|woff|svg)$"> ExpiresDefault A31536000 </FilesMatch> <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$"> ExpiresDefault A31536000 </FilesMatch> </IfModule> <IfModule mod_headers.c> <FilesMatch "\.(txt|xml|js)$"> Header set Cache-Control "max-age=31536000" </FilesMatch> <FilesMatch "\.(css)$"> Header set Cache-Control "max-age=31536000" </FilesMatch> <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav|mp4|m4v|ogg|webm|aac|eot|ttf|otf|woff|svg)$"> Header set Cache-Control "max-age=31536000" </FilesMatch> <FilesMatch "\.(jpg|jpeg|png|gif|swf|webp)$"> Header set Cache-Control "max-age=31536000" </FilesMatch> </IfModule> # END WP-HUMMINGBIRD-CACHING # Wordfence WAF <Files ".user.ini"> <IfModule mod_authz_core.c> Require all denied </IfModule> <IfModule !mod_authz_core.c> Order deny,allow Deny from all </IfModule> </Files> # END Wordfence WAF # BEGIN FRedirect_ErrorDocument # Le direttive (linee) tra <code>BEGIN FRedirect_ErrorDocument</code> e <code>END FRedirect_ErrorDocument</code> sono # generate dinamicamente, e dovrebbero essere modificate solo tramite i filtri di WordPress. # Ogni modifica alle direttive tra questi marcatori verrà sovrascritta. ErrorDocument 404 /index.php?error=404 # END FRedirect_ErrorDocument ----------------------------------------------
This reply was modified 3 years, 6 months ago by
Yui. Reason: formatting
@caso85 Please try moving the .htaccess redirect from Really Simple SSL to the top of the file.
#Begin Really Simple Security <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{REQUEST_URI} !wp-content\/cache\/(all|wpfc-mobile-cache) RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> Options -Indexes #End Really Simple Securityyeahhhhh it works!!! thanks a lot for the advice!
try it yourself to confirm -> http://www.danielecasonato.com
looks good!
-
This reply was modified 3 years, 6 months ago by
The topic ‘Problem 301 redirect HTTP->HTTPS’ is closed to new replies.