1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Disabling http:// from webserver.

Discussion in 'Site & Server Administration' started by psb_hoit, Jul 31, 2012.

  1. #1
    Hi,

    We have Apache version: 2.2.3 on on Linux O/S. We have recently installed SSL on this webserver. Now when we browse our website using www.domain-name.com it directly opens up in http:// not in https://. For opening the website in https:// we explicitly have to type https://www.domain-name.com in browser.

    What should we do so that our website opens up directly in https:// irrespective of whether we type www.domain-name.com or http://www.domain-name.com?

    Regards,
    IT
     
    psb_hoit, Jul 31, 2012 IP
  2. Snat

    Snat Well-Known Member

    Messages:
    86
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    130
    #2
    This .htaccess should do the trick. Add this to your .htaccess file or make it in the site directory.

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    Code (markup):
     
    Snat, Jul 31, 2012 IP
  3. psb_hoit

    psb_hoit Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Snat,

    When we search for .htaccess file, we find many such files, like:

    [root@/]# find -name .htaccess
    ./home/zabbix/zabbix/frontends/php/conf/.htaccess
    ./home/zabbix/zabbix/frontends/php/api/.htaccess
    ./home/zabbix/zabbix/frontends/php/include/classes/.htaccess
    ./home/zabbix/zabbix/frontends/php/include/.htaccess
    ./usr/local/src/phpMyAdmin-3.3.8.1-all-languages/libraries/.htaccess
    ./usr/local/src/phpMyAdmin-3.3.8.1-all-languages/setup/lib/.htaccess
    ./var/www/html/phpMyAdmin/libraries/.htaccess
    ./var/www/html/.htaccess
    [root@/]#

    So in which .htaccess file should we add these three line of code?Regards,
     
    psb_hoit, Jul 31, 2012 IP
  4. Snat

    Snat Well-Known Member

    Messages:
    86
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    130
    #4
    I can't tell you sadly without knowing which directory your website is hosted in. If you tell me what folder your website is in, I can tell you which one you need to edit.
     
    Snat, Jul 31, 2012 IP
  5. psb_hoit

    psb_hoit Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Dear Snat,

    We have our website hosted in directory - ./var/www/html/

    We added the three lines in .htaccess file present in this directory but this did not work. Any more suggestions...

    Thanks,
     
    psb_hoit, Jul 31, 2012 IP
  6. amgadhs

    amgadhs Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Its /var/www/html/.htaccess
     
    amgadhs, Jul 31, 2012 IP
  7. cesurasean

    cesurasean Active Member

    Messages:
    269
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    80
    #7
    You can edit your apache directives and remove the http entries.
     
    cesurasean, Aug 1, 2012 IP