If you already have an active
DV SSL service or an established
SSL service, and your website is accessible in the browser via the secure HTTPS protocol at https://www.mydomain.com, you can set up automatic redirection.
The website will then be accessible only via the HTTPS protocol, and all communication will be encrypted. It is not possible to issue an SSL certificate within the DV SSL service for alias domains. Activating SSL for alias domains is possible with the
additional SSL service.
If you use a content management system (WordPress, Joomla, Prestashop, or similar) on your website, this redirection can usually be set directly from their administration interface.
For faster redirection
on the new Linux hosting, you can enable "SSL redirect" on the proxy servers in the website settings after logging into the administration at
https://admin.forpsi.com:
For faster redirection on servers with Linux or Windows operating systems, you can use a file named ".htaccess". The "web.config" file works only on servers with a Windows operating system.
Add the following lines to the files based on the specific redirection requirements for aliases. In the example code, you only need to modify the domain name "www.mydomain.com" to your domain.
Example of .htaccess file - redirection to a specific domain and adding www:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off [NC,OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) https://www.mydomain.com%{REQUEST_URI} [L,R=301,QSA]
Example of .htaccess file - redirection keeping the domain/alias in the address:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,QSA]
Example of web.config file for redirecting the main domain only:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Example of web.config file for redirecting the main domain including aliases:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
<add input="{HTTP_HOST}" pattern="^www.mydomain.com$" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://www.mydomain.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
In this example, we set up automatic redirection of http://www.forpsi-test.com/ to https://www.forpsi-test.com/ using the first example Example of .htaccess file - redirection to a specific domain.
For the setup, we will need an FTP client. We recommend the
Filezilla client and a text editor, such as
Notepad++, which is free.
We do not recommend editing the ".htaccess" file in the available "Notepad", as saving it might alter its format and encoding.
After setting up the FTP connection, check if the ".htaccess" file exists in the /www/ folder. If it does, download the file to your local disk and edit it using Notepad++. Insert the rules at the very beginning of the file, leaving the other content unchanged.
If the file does not exist, create a new file in Notepad++ using the "File -> New" option.
Copy all lines from the first example and paste them into Notepad++:
RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{HTTPS} off [NC] RewriteRule (.*) https://www.example-domain.com%{REQUEST_URI} [L,R=301,QSA]
Notepad++ and the sample .htaccess from the example
Now, modify the placeholder domain name "example-domain.com" on the 3rd line to "forpsi-test.com" in Notepad++:
Notepad++ with updated .htaccess content
Save the file using the "File -> Save As" option:
- In the "File name"field, type:
- In the "Save as type"dropdown, select:
Save the file to a folder on your local computer:
Saving the .htaccess file in Notepad++
The file is now ready to be uploaded to your FTP account in the
"/www/"folder or to overwrite the existing file if you were editing an already existing one:
Uploading .htaccess to the FTP account using FileZilla
Everything should now be set up. Test in your browser by entering your domain without the HTTPS protocol, e.g., http://your-domain.com, to see if it redirects to the secured HTTPS protocol as configured in the ".htaccess" file.
For this test, we recommend using the browser's "incognito mode" to avoid loading content from the browser cache.
If you have SSL enabled for subdomains, you will need to perform the same setup with the corresponding address for them and upload the ".htaccess" file to their root directories "/subdoms/subdomain_name/" on the FTP account.
On your website, you might encounter an issue where some content (e.g., images, JavaScript, CSS) loads via the HTTP protocol, causing the browser to display a warning that the site is not fully secured.