How can I redirect my domain to show https://www in the URL bar?

Let's say you have the domain ethernetservers.com and wish to have it automatically redirect to https://www.ethernetservers.com (note the https:// and www.) when visitors go to ethernetservers.com, this can be easily achieved using htaccess!

Create (or modify) a file called ".htaccess" in your domain's root directory, and add the following:

RewriteEngine On
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

That's it, you're done! 

Please note, you may need to clear your browser cache (or try another web browser) to see the change take effect. 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Below is a full list of all the options that will be available within your cPanel account: FILES File Manager Images Directory Privacy Disk Usage Web Disk FTP Accounts FTP Connections...

Read More ...

The name servers vary depending on the server that your account is on. Please search your email for a message titled Your cPanel Hosting Login Information for the name servers.

Read More ...

Errors can appear on websites for a number of reasons. Usually, these issues are quick to diagnose and fix, but sometimes further investigation may be required. Below are the most common error...

Read More ...

If your website is being slow, we suggest doing the following: – Try to access your domain in another web browser. For example, if you’re using Internet Explorer, try using Google Chrome, and...

Read More ...

These are some of the things we recommend you do to help secure your website.   1) Keep software/scripts up to date. You need to regularly monitor the web sites of the developers of any scripts...

Read More ...