SSL Redirect on Network Solutions Shared Web Hosting

Those who are using Network Solutions as a hosting provider with a UNIX hosting package must be facing issues while setting-up redirection from HTTP to HTTPS. There many few ways to setting-up redirection through htaccess such as:


RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

OR

RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^.*$ https://www.domain.com%{REQUEST_URI} [R=permanent,L]

OR

RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain.com [NC]
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L]

OR

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]


None of these will work on network solutions.com and your website will stuck in an infinite loop and show error page.

SSL Redirect on Network Solutions Shared Hosting

Here’s the reason: Network Solutions handles their shared hosting systems in a way that you don’t actually connect to a server, you connect to a proxy server so you are performing your HTTPS transaction with the proxy server, not your shared host. The proxy server translates your HTTPS connection to HTTP over port 80. When attempting to detect this with .htaccess, the server doesn’t see HTTPS because the connection between your hosting server and the proxy will always be HTTP on port 80. Because PHP pulls the HTTPS variable from Apache, it will have the identical outcome to detecting HTTP through .htaccess.


Enough about technicalities. Now, here’s the code that actually works on Network Solutions Shared Hosting:

RewriteEngine on

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


Leave a Reply

  • (will not be published)