Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

htaccess redirect http to https

RewriteEngine On

### WWW & HTTPS

# ensure www.
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ensure https
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

### WWW & HTTPS
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #htaccess #redirect #http #https
ADD COMMENT
Topic
Name
9+3 =