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


You can force your site to redirect to its secure URL by creating a configuration file and adding some code to it. To create this file, you must log into your server via FTP or SSH as described below.

When you add an SSL certificate to your website, the URL visitors use to view your site changes from HTTP to HTTPS. The 'S' ensures that your connection is encrypted.

After adding an SSL certificate you should force all URLs on your site to automatically redirect to the HTTPS version. For example, if someone visited:

you'd want it to automatically redirect to:

It's not possible to use the panel's Redirect option with an SSL certificate as this removes hosting from the domain. The only option is to create a custom file to redirect your site to https.

What configuration file do I need to create?

This depends on your server type. For example, your server is either running Apache or Nginx.

For Apache servers

The majority of all DreamHost customers are running their site on an Apache server. In this case you'd just need to create an .htaccess file for your site.

For Nginx servers

If your site is running on a VPS or Dedicated server, and you have manually configured it to run Nginx instead, you need to create a redirects.conf file. View the link below for further information.

Unless you've manually changed your VPS or Dedicated server to run Nginx, you are using Apache.

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?