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]


One Response to “SSL Redirect on Network Solutions Shared Web Hosting”

  1. <path_to_url> Erik Milham

    0

    This is the ONLY Clean way to Redirect with Networksolutions. Took me hours of testing. Works best for SEO. Network Solutions is a challenging Hosting platform.

    This will work .htaccess all you replace is changeexample.com with your domain. Easy.

    ## Base Redirects ##

    # Turn on Rewrite Engine
    RewriteEngine On

    # Remove trailing slash from non-filepath urls
    RewriteCond %{REQUEST_URI} /(.+)/$
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ https://changeexample.com/%1 [R=301,L]

    # Include trailing slash on directory
    RewriteCond %{REQUEST_URI} !(.+)/$
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.+)$ https://changeexample.com/$1/ [R=301,L]

    # Force HTTPS and remove WWW
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [OR,NC]
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^(.*)$ https://changeexample.com/$1 [R=301,L]

    Best of Luck! This is current as of 05/14/2021

Leave a Reply

  • (will not be published)