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

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:

http://example.com/page1

you'd want it to automatically redirect to:

https://example.com/page1

You can make sure your site redirects to the secure URL by creating a configuration file.

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.