skip to Main Content

my one website is on https and all other websites on non-https means http if i visit any pages of http website with https it is redirect to https website
i am using WHM version 11.50.6 and Server OS is CentOS 6.8

2

Answers


  1. Chosen as BEST ANSWER
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule .*  https://domainname.co.uk/$1 [L,R=301]
    
    RewriteEngine On
    RewriteCond %{HTTPS} on
    RewriteCond %{HTTP_HOST} !^domainname.co.uk$
    RewriteRule .* http://%{HTTP_HOST} [L,R=302]
    

  2. Redirecting HTTP to HTTPS is set by rewrite rules specified in your htaccess file/server settings. I believe what would have happened in your case is, the rewrite rule has been set to match any URL.

    Any URL redirect:

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

    Specific domain redirect:

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

    Specific folder redirect:

    RewriteEngine On 
    RewriteCond %{SERVER_PORT} 80 
    RewriteCond %{REQUEST_URI} folder 
    RewriteRule ^(.*)$ https://www.abcd.com/folder/$1 [R,L]
    

    If you want to deny access while accessing from other domains use order allow,deny

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search