When you add an SSL certificate to your website in the panel, DreamHost automatically redirects the URL visitors use to view your site from HTTP to HTTPS. The S ensures that your connection is encrypted. For example:
There's nothing on your end you must do in order to force your site to use the secure URL.
Adding custom code to force the redirect
In some special cases, it may be necessary for you to create your own custom configuration file to force the redirect from HTTP to HTTPS. To create this file, you must log in to your server via FTP or SSH as described below.
Adding custom code is only necessary if your website requires specific code to force the redirect. As stated above, your site will automatically redirect when you add an SSL certificate in the panel, so adding custom rules is only necessary if your website requires them.
If you need to manually force the redirect to HTTPS using specialized rules, you must first disable the automatic redirect in your panel. View the following article for instructions on how to remove the DreamHost service that automatically redirects your site to HTTPS.
When the DreamHost redirect is no longer active, only your custom code will control the redirect to the HTTPS version of your site.
Using the panel's redirect service to force HTTPS
It is not possible to use the panel's Redirect service to force your site to load the HTTPS version of its URL.
This is because the HTTPS service only functions when the site is Fully Hosted, and the Redirect service removes hosting from the domain.
What configuration file do I need to create?
If your site requires custom code to force the redirect to HTTPS, you will need to update a configuration file for your domain on the server. The name and location of the custom configuration file is different depending on what type of server your site is running on. This would either be 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
Unless you've manually changed your VPS or Dedicated Server to run Nginx, you are using Apache.