Sat, January 23, 2021
 
https://devcodepro.comdevcodepro
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: 1823  / 3 years ago, sat, jun 23, 18, 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, 2:34:15
 
Ronald
commented 3 years ago
Only authorized users can post. Please sign in first, or register a free account
 
Share
Posted
my3profile
Member since May 21, 2018
Total Code Snippets: 4
Total Comments: 1
Location: n/a
my3profile snippets
3 years ago, mon, may 21, 18, 4:27:10
comments: 0 / hits: 1054
2 years ago, sun, jan 20, 19, 7:48:04
comments: 0 / hits: 796
PHP
2 years ago, sun, jan 20, 19, 8:37:34
comments: 0 / hits: 713
PHP