force ssl ด้วย php

< ?php
 if ( !$_SERVER['HTTPS'] ) {
 header("location:https://www.yourdomain.com");
 exit;
 }
 ?>

อีกวิธีการหนึ่งคือใช้  .htaccess

วิธีที่ 1:

SSLOptions +StrictRequire
SSLRequireSSL
SSLRequire %{HTTP_HOST} eq "domain.com"
ErrorDocument 403 https://domain.com

วิธีที่ 2:

SSLOptions +StrictRequire
SSLRequireSSL
SSLRequire %{HTTP_HOST} eq "domain.com"
ErrorDocument 403 https://domain.com

ข้อมูลเพิ่มเติม

Popularity: 1% [?]

Tagged with:
 

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Set your Twitter account name in your settings to use the TwitterBar Section.