How to force your site to redirect to https (SSL) - Gregg Hosting

The affects of Web Hosts on Your Business Website

Here're ways your choice of web hosting service provider impacts the performance of your business:


Website loading speed


Uptime and availability


Customer support




Server location

How to force your site to redirect to https (SSL)

How to force your site to redirect to https (SSL)


GreggHost automatically changes the URL visitors use to browse your site from HTTP to HTTPS when you add an SSL certificate to your website in the panel. Your connection will be encrypted thanks to the S. Consider the following scenario:

You don’t need to do anything on your end to force your site to utilize the secure URL.


Adding custom code to force the redirect

To force the redirect from HTTP to HTTPS in some unusual instances, you may need to build your own unique configuration file. To create this file, use FTP or SSH to connect to your server as instructed below.


If your website requires particular code to force the redirect, you’ll need to add custom code. As previously said, when you add an SSL certificate to the panel, your site will immediately redirect, therefore adding custom rules is only necessary if your website requires them.


If you need to use custom rules to compel the redirect to HTTPS, you must first disable the automated redirect in your panel. Instructions for removing the GreggHost service that automatically redirects your site to HTTPS may be found in the following article.


Disabling the automatic HTTPS redirection

Only your own code will control the redirect to the HTTPS version of your site once the GreggHost redirect is no longer active.


Using the panel’s redirect service to force HTTPS

It is not possible to force your site to load the HTTPS version of its URL using the panel’s Redirect feature.


Because the HTTPS service is only available when the site is fully hosted, and the Redirect service removes hosting from the domain, this is the case.


What configuration file do I need to create?

You’ll need to alter a configuration file for your domain on the server if your site requires specific code to force the redirect to HTTPS. Depending on the type of server your site is hosted on, the name and location of the custom configuration file may differ. It’s either Apache or Nginx in this case.


For Apache servers

The majority of GreggHost customers use an Apache server to host their website. In this scenario, all you have to do is create an.htaccess file for your website.


Using an.htaccess file, you may force your site to load securely.

For Nginx servers

You’ll need to create a redirects.conf file if your site is hosted on a VPS or Dedicated Server and you’ve manually configured it to run Nginx instead of Apache. For further information, see the link below.


Getting your Nginx site to load in a secure manner

Unless you’ve updated your VPS or Dedicated Server to run Nginx manually, you’re still using Apache.