![]() |
|
|||||||
| 闲话灌水 追逐时尚话题,共度开心时刻,体会生活点滴,分享精彩人生。 |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
IP: 153.99.31.192
|
|||
|
|||
|
Forcing a specific domain to use HTTPS
To force a specific domain to use HTTPS, use the following lines of code in the .htaccess file in your website's root folder: RewriteEngine On RewriteCond %{HTTP_HOST} ^abcd\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.xyz.com/$1 [R,L] In the .htaccess code above, if abcd.com website is accessed, it will re-direct to https://xyz.com You will need to replace abcd\.com with the domain name you're forcing to https and also replace www.xyz.com with the domain name to where the website traffic will be re-directed. Here's an example: RewriteEngine On RewriteCond %{HTTP_HOST} ^test-site\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.some-website.com/$1 [R,L] In the example above, any one typing in http://test-site.com will automatically be re-directed to https://some-website.com. Forcing all website traffic to use HTTPS In order to force all web traffic to use HTTPS, use the following code in your .htaccess file. If you are hosting multiple websites on your account, it is possible to have an .htaccess file for each website. Make sure that you are editing the .htaccess file that is in the root folder where you want the re-direct to occur. RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L] Be sure to replace www.yourdomain.com with your actual domain name. Forcing SSL on a specific folder If you want to force SSL on a specific folder you can insert the code below into a .htaccess file placed in that specific folder: RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} folder RewriteRule ^(.*)$ https://www.yourdomain.com/folder/$1 [R,L] Make sure you change the folder reference to the actual folder name. Then be sure to replace www.yourdomain.com/folder with your actual domain name and folder you want to force the SSL on. |
![]() |
| Currently Active Users Viewing This Thread: 2 (0 members and 2 guests) | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How To Force Https On Your X-Cart Admin And X-Cart Provider Sections | Tenakee Springs | X-Cart | 0 | 2015-03-31 12:58 AM |
| PayPal 支付模块简介 Website Payments Standard/Pro/Express Checkout | yahoo | 电子商务 | 0 | 2009-10-21 12:07 PM |
| 101 ways to get more traffic | sunshine | Google Adsense | 0 | 2007-05-09 08:29 PM |
| Website especially for adsene | indianboy | Google Adsense | 1 | 2006-04-05 01:08 AM |
| Comprehensive List of SEO Tools | topvip | 搜索引擎市场营销研究 | 0 | 2006-03-23 01:16 AM |