Tue, October 27, 2020, 20:46:59
 
Home · Latest · Trends  /  Apache
6

htaccess redirect http to https

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
rated 6 times [  6] [ 0]  / comments: 1 / hits: 1676  / 2 years ago, sat, jun 23, 2018, 11:07:37
More From » Apache
 

Comments

3
This code work for me
Code:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com\folder
RewriteRule ^(.*)$ https://www.example.com\folder/$1 [R,L]
[#9] Friday, July 27, 2018, 14:34:15
 
Ronald
commented 2 years ago
Username
 
Your Comment
 
Share
Snippets
2 years ago, mon, may 21, 2018
2 years ago, sun, jan 20, 2019
2 years ago, sun, jan 20, 2019
Posted
my3profile

my3profile

Member since May 21, 2018
Total Code Snippets: 4
Total Comments: 1
Location: n/a
Following
User not following anyone yet.