How to redirect site from http to https?

Started by nick_sinigamy, Jun 27, 2022, 01:59 AM

Previous topic - Next topic

nick_sinigamyTopic starter

I have purchased SSL certificate for my site.

But I have more than 1 site purchased from go daddy. So whenever I add htaccess file to my site, the other sites, stop working.

What should I do?

I have talked many times to customer support but this problem never gets solved.

My site is working on both URLs http & https.

Suggest something.


To redirect http URLs to https, do the following:

<VirtualHost *:80>
    Redirect /

<VirtualHost *:443>
    # ... SSL configuration goes here

This snippet should go into main server configuration file, not into .htaccess as asked in the question.

This article might have come up only after the question was asked and answered, but seems to be the current way to go.
    The following users thanked this post: Sevad


Using the following code in your .htaccess file automatically redirects visitors to the HTTPS version of your site:

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


To make a link to one webpage redirect to the opening of another, add to the file .htaccess the following line:

Redirect 301/
In the proposed version:
Redirect 301 - an instruction that informs you that the page has been moved permanently; - the address of the page to which the redirection is taking place.
When using 301 redirects, the site's rating in search engines is preserved.

Redirection to another domain.
In the instance below, a redirect is performed with on

RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.)?old-domain\.com$RewriteRule ^(.*)$$1 [R=301,L]
RewriteCond sets the condition under which the rule specified in the RewriteRule is executed. Thus, when requesting any webpage or the transition to the address will be carried out .