Automatically Redirect Visitors to SSL-Secured Site

Steps for Linux Packages

  • Open a basic text editor, such as Notepad (Windows) or TextEdit (MacOS).
  • Copy and paste the code below into your text editor.
  • In the text editor, replace “example.com” with your own domain.
  • Save the file as .htaccess and choose to Save as type: All Files (*.*) underneath the file name.
  • Upload the File Using Webpage Explorer to the root of your webspace.

Steps for Windows Packages

  • Open a basic text editor, such as Notepad (Windows) or TextEdit (MacOS).
  • Copy and Paste the code below into the text editor.
<%EnableSessionState=False
host = Request.ServerVariables("HTTP_HOST")

if host = "example.com" or host = "www.example.com" then
response.redirect("https://www.example.com/")

else
response.redirect("https://www.example.com/error.htm")

end if
%>
  • In the text editor, replace all instances of “example.com” with your own domain.
  • Save the file as index.asp.
  • Upload the File via FTPS to the root of your webspace.

Editorial Team
Latest posts by Editorial Team (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.