Follow

How do I write about so all visitors coming to https?

Simplest is to create a .htaccess file in that directory rewriting should be done in (usually public_html) and add your code that writes about the visit to your page to the HTTPS protocol.

Here are some examples of how it can be done.

Write a visit to https: //www.domain name.com (with WWW)

RewriteEngine On 

# If not using www
RewriteCond% {HTTP_HOST}! ^ Www. () * $ [NC]
RewriteCond% {HTTP: HTTPS}! On
RewriteRule. * Https: //www.% {HTTP_HOST}% {REQUEST_URI} [R, L]

# If using www
RewriteCond% {HTTP_HOST} ^ www. (. *) $ [NC]
RewriteCond% {HTTP: HTTPS}! On
RewriteRule. * Https: //% {HTTP_HOST}% {REQUEST_URI} R, L]

Write a visit to https: //domainname.com (without WWW)

 

RewriteEngine On 

RewriteCond% {HTTP: HTTPS}! On
RewriteRule. * Https: //% {HTTP_HOST}% {REQUEST_URI} [R, L]

# If using www
RewriteCond% {HTTP_HOST} ^ www \. (. *) $ [ NC]
RewriteCond% {HTTP: HTTPS}! On
RewriteRule. * Https: //domännamn.se% {REQUEST_URI} [R, L]

 

Note that you need to replace "https: //domainname.com" against your actual domain name for the certificate.

Write about visits both without and with WWW

 

RewriteEngine On 

RewriteCond% {HTTP: HTTPS}! On
RewriteRule. * Https: //% {HTTP_HOST}% {REQUEST_URI} [R, L]

 

Note that in order to run HTTPS both without and with WWW, you must update both your A pointers to the IP address that applies to your SSL certificate.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.