Web Hosting Forum Login
Not a member yet? Sign up

Forcing SSL with .htaccess, cPanel & CloudFlare

  • HOME
  • FORUMS
  • WEB DESIGN
  • WEB HOSTING OFFERS
  • ADVERTISING
  • FIND A HOST
  • WEB HOSTING
  • QUICK MENU
  • REGISTER HERE - Join us for FREE
Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2016
    Location
    Amsterdam, The Netherlands
    Posts
    65
    Thanks
    1
    Thanked 15 Times in 9 Posts
    Thumbs Up/Down
    Received: 44/0
    Given: 7/0

    Red face Forcing SSL with .htaccess, cPanel & CloudFlare

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

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

    If you have an existing .htaccess file:

    - Do not duplicate RewriteEngine On.
    - Make sure the lines beginning RewriteCond and RewriteRule immediately follow the already-existing RewriteEngine On.


    Forcing SSL via cPanel follow this steps:

    - access the redirects section
    - set permanent (301) redirect
    - choose the domain name
    - enter the site's url using the SSL certificate
    - make sure wild card redirect is selected
    - select redirect with or without www


    Forcing SSL via CloudFlare follow this steps:

    - Login into your CloudFlare account, choose the domain which you wish to enforce the SSL.
    - From there select the Page Rules section and select Create Page Rules.
    - Add your URL and select Add a Setting.
    - Under Add a Setting select SSL and for SSL Settings choose Full.
    HostBastic.com - Fast SSD Hosting
    Web Hosting | Reseller | Custom Virtual Servers | Game Servers
    cPanel | LiteSpeed | CloudLinux | FREE SSL | 100% SSD | DDoS Protected | 99.9% Uptime

  2. The Following 6 Users Say Thank You to HostBastic For This Useful Post:
    Chris Worner (01-06-2017),GswHosting (01-06-2017),LJSHost (01-06-2017),Maxoq (01-06-2017),VirtuBox (01-11-2017),wittwerch (01-19-2017)

  3. #2
    Join Date
    Feb 2015
    Posts
    210
    Thanks
    113
    Thanked 21 Times in 19 Posts
    Thumbs Up/Down
    Received: 31/0
    Given: 244/0
    This is a good option to force SSL (https) with .htaccess file
    By the way, you know ways to enable SSL for websites that using Cloudflare or enable SSL from cPanel ?

  4. #3
    Join Date
    Dec 2016
    Location
    Midwest USA
    Posts
    255
    Thanks
    23
    Thanked 11 Times in 11 Posts
    Thumbs Up/Down
    Received: 110/0
    Given: 35/0
    To enable SSL from cPanel you need to install a certificate. If you manage the server you can now use the Manage AutoSSL area and get free ssl for all sites.

    I would contact cloudflare or see here http://forumweb.hosting/14172-how-to-install-a-cloudflare-free-ssl-certificate-in-plesk-onyx.html
    Energized Web Hosting
    Shared Hosting | Reseller Hosting | VPS | Domain Names
    Ministry Web Hosting

  5. #4
    Join Date
    Nov 2016
    Location
    Amsterdam, The Netherlands
    Posts
    65
    Thanks
    1
    Thanked 15 Times in 9 Posts
    Thumbs Up/Down
    Received: 44/0
    Given: 7/0
    If you wish to force SSL via cPanel follow this steps:

    - access the redirects section
    - set permanent (301) redirect
    - choose the domain name
    - enter the site's url using the SSL certificate
    - make sure wild card redirect is selected
    - select redirect with or without www

    With CloudFlare you can do so by creating a page rule which enforces HTTPS for the selected URL.

  6. The Following User Says Thank You to HostBastic For This Useful Post:
    LJSHost (01-06-2017)

  7. #5
    Join Date
    Feb 2015
    Posts
    210
    Thanks
    113
    Thanked 21 Times in 19 Posts
    Thumbs Up/Down
    Received: 31/0
    Given: 244/0
    Quote Originally Posted by HostBastic View Post
    If you wish to force SSL via cPanel follow this steps:

    - access the redirects section
    - set permanent (301) redirect
    - choose the domain name
    - enter the site's url using the SSL certificate
    - make sure wild card redirect is selected
    - select redirect with or without www
    Thanks for the tips!
    I could do this on my cPanel.

    Quote Originally Posted by HostBastic View Post
    With CloudFlare you can do so by creating a page rule which enforces HTTPS for the selected URL.
    Can you go into the details for this step with some screenshots or where I can create and how to setup them?

  8. #6
    Join Date
    Nov 2016
    Location
    Amsterdam, The Netherlands
    Posts
    65
    Thanks
    1
    Thanked 15 Times in 9 Posts
    Thumbs Up/Down
    Received: 44/0
    Given: 7/0
    Quote Originally Posted by Maxoq View Post
    Can you go into the details for this step with some screenshots or where I can create and how to setup them?
    1. Login into your CloudFlare account, choose the domain which you wish to enforce the SSL.
    2. From there select the Page Rules section and select Create Page Rules.
    3. Add your URL and select Add a Setting.
    4. Under Add a Setting select SSL and for SSL Settings choose Full.
    HostBastic.com - Fast SSD Hosting
    Web Hosting | Reseller | Custom Virtual Servers | Game Servers
    cPanel | LiteSpeed | CloudLinux | FREE SSL | 100% SSD | DDoS Protected | 99.9% Uptime

  9. The Following 2 Users Say Thank You to HostBastic For This Useful Post:
    LJSHost (01-06-2017),Maxoq (01-06-2017)

  10. #7
    Join Date
    May 2016
    Location
    France
    Posts
    748
    Thanks
    65
    Thanked 221 Times in 166 Posts
    Thumbs Up/Down
    Received: 472/1
    Given: 201/0
    You can add the following for Nginx :

    Code:
        server {
        listen 80;
        server_name yourdomain.com www.yourdomain.com;
        return 301 https://yourdomain.com$request_uri;
    }

  11. The Following User Says Thank You to VirtuBox For This Useful Post:
    HostBastic (01-11-2017)

  12. #8
    Join Date
    Jan 2017
    Location
    Vilnius, Lithuania
    Posts
    52
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Thumbs Up/Down
    Received: 22/0
    Given: 3/0
    If you want to enforce SSL only on specific page of your website you can change .htaccess rule as follows:

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule register.php https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    Where "register.php" would be part of website that needs to be encrypted.

Newer Threads

  1. energizedit
    archhosting
    Replies: 12 | Views: 739
    Last post by archhosting, 02-07-2017, 09:47 AM
  2. energizedit
    HostXNow
    Replies: 3 | Views: 622
    Last post by HostXNow, 01-07-2017, 06:28 PM
  3. JoeTaxpayer
    JoeTaxpayer
    Replies: 8 | Views: 679
    Last post by JoeTaxpayer, 01-25-2017, 03:55 AM
  4. JoeTaxpayer
    Web hosting to run web tools?
    By JoeTaxpayer in forum Web Hosting
    VictorVictories
    Replies: 8 | Views: 685
    Last post by VictorVictories, 02-22-2017, 12:37 PM
  5. Mujkanovic
    What does drwxr-sr-x mean?
    By Mujkanovic in forum Web Hosting
    LJSHost
    Replies: 1 | Views: 378
    Last post by LJSHost, 01-07-2017, 02:54 AM

Older Threads

  1. EcommIndiaCloudIT
    EcommIndiaCloudIT
    Replies: 0 | Views: 127
    Last post by EcommIndiaCloudIT, 01-06-2017, 02:56 PM
  2. Chris Worner
    Chris Worner
    Replies: 6 | Views: 483
    Last post by Chris Worner, 01-06-2017, 02:59 PM
  3. Moebuntu
    RDO Servers
    Replies: 3 | Views: 707
    Last post by RDO Servers, 01-06-2017, 03:59 PM
  4. Dr. McKay
    RAID 1 vs RAID 10
    By Dr. McKay in forum Dedicated Server
    HostYourNet-DR
    Replies: 18 | Views: 1181
    Last post by HostYourNet-DR, 01-20-2017, 10:28 AM
  5. Vishnu
    Vishnu
    Replies: 0 | Views: 156
    Last post by Vishnu, 01-06-2017, 08:11 AM

Latest Threads

  1. Prometheus
    Prometheus
    Replies: 0 | Views: 6
    Last post by Prometheus, Today, 05:07 AM
  2. mtlmtlmtl
    RDO Servers
    Replies: 1 | Views: 19
    Last post by RDO Servers, Yesterday, 08:22 PM
  3. NuWebHosting
    NuWebHosting
    Replies: 4 | Views: 36
    Last post by NuWebHosting, Yesterday, 08:54 PM
  4. jadoinc
    austenite
    Replies: 7 | Views: 110
    Last post by austenite, Today, 12:28 AM
  5. liveinhost
    liveinhost
    Replies: 0 | Views: 35
    Last post by liveinhost, 02-25-2017, 06:01 PM

Similar Threads

  1. Gecko
    GswHosting
    Replies: 4 | Views: 233
    Last post by GswHosting, 08-29-2016, 12:01 PM
  2. Maxoq
    cochinweb
    Replies: 2 | Views: 200
    Last post by cochinweb, 08-20-2016, 02:44 PM
  3. karlkoeller
    nairprasad7
    Replies: 5 | Views: 606
    Last post by nairprasad7, 08-19-2016, 11:10 AM
  4. agelinajohly
    ElixantTechnology
    Replies: 6 | Views: 2189
    Last post by ElixantTechnology, 11-30-2014, 10:46 AM
  5. sanusense
    ironcladservers
    Replies: 2 | Views: 1559
    Last post by ironcladservers, 07-11-2014, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Web Hosting Forum

ForumWeb.Hosting is a web hosting forum where you’ll find in-depth discussions and resources to help you find the best hosting providers for your websites or how to manage your hosting whether you are new or experienced. You’ll find it all here. With topics ranging from web hosting, internet marketing, search engine optimization, social networking, make money online, affiliate marketing as well as hands-on technical support for web design, programming and more. We are a growing community of like-minded people that is keen to help and support each other with ambitions and online endeavors. Learn and grow, make friends and contacts for life.

Community

The world's smartest hosting providers come here to discuss & share what's trending in the web hosting world!
Copyright ©2017, ForumWeb.Hosting. All rights reserved. Web Hosting Forum for webmasters, web hosting providers, designers and web developers.

Welcome to Forum Web Hosting

The World's Number 1 Web Hosting Community, Reviews & Services

Log in!

Continue with Facebook
Continue With Email. By signing up you indicate that you have read and agree to the Terms of Service and Privacy Policy.

Sign in Manually

Need an account? Sign up now!