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.domainname.com (with WWW)

RewriteEngine On

RewriteCond %{HTTP:HTTPS} !on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteCond %{HTTP:HTTPS} !on
RewriteRule .* https://www.domainname.com%{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]
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteCond %{HTTP:HTTPS} !on
RewriteRule .* https://domainname.com%{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

Article is closed for comments.