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
    58
    Thanks
    1
    Thanked 15 Times in 9 Posts
    Thumbs Up/Down
    Received: 42/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: 30/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
    254
    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
    58
    Thanks
    1
    Thanked 15 Times in 9 Posts
    Thumbs Up/Down
    Received: 42/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: 30/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
    58
    Thanks
    1
    Thanked 15 Times in 9 Posts
    Thumbs Up/Down
    Received: 42/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
    747
    Thanks
    65
    Thanked 221 Times in 166 Posts
    Thumbs Up/Down
    Received: 471/1
    Given: 199/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: 683
    Last post by archhosting, 02-07-2017, 09:47 AM
  2. energizedit
    HostXNow
    Replies: 3 | Views: 578
    Last post by HostXNow, 01-07-2017, 06:28 PM
  3. JoeTaxpayer
    JoeTaxpayer
    Replies: 8 | Views: 627
    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: 640
    Last post by VictorVictories, Yesterday, 12:37 PM
  5. Mujkanovic
    What does drwxr-sr-x mean?
    By Mujkanovic in forum Web Hosting
    LJSHost
    Replies: 1 | Views: 371
    Last post by LJSHost, 01-07-2017, 02:54 AM

Older Threads

  1. EcommIndiaCloudIT
    EcommIndiaCloudIT
    Replies: 0 | Views: 121
    Last post by EcommIndiaCloudIT, 01-06-2017, 02:56 PM
  2. Chris Worner
    Chris Worner
    Replies: 6 | Views: 472
    Last post by Chris Worner, 01-06-2017, 02:59 PM
  3. Moebuntu
    RDO Servers
    Replies: 3 | Views: 677
    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: 1135
    Last post by HostYourNet-DR, 01-20-2017, 10:28 AM
  5. Vishnu
    Vishnu
    Replies: 0 | Views: 147
    Last post by Vishnu, 01-06-2017, 08:11 AM

Latest Threads

  1. DTS-NET
    DTS-NET
    Replies: 0 | Views: 8
    Last post by DTS-NET, Today, 04:27 PM
  2. Mihai B.
    AlbaHost
    Replies: 1 | Views: 26
    Last post by AlbaHost, Today, 04:33 PM
  3. steitieh
    steitieh
    Replies: 0 | Views: 13
    Last post by steitieh, Today, 03:16 PM
  4. steitieh
    HostBastic
    Replies: 2 | Views: 45
    Last post by HostBastic, Today, 04:43 PM
  5. steitieh
    AlbaHost
    Replies: 1 | Views: 13
    Last post by AlbaHost, Today, 04:39 PM

Similar Threads

  1. Gecko
    GswHosting
    Replies: 4 | Views: 231
    Last post by GswHosting, 08-29-2016, 12:01 PM
  2. Maxoq
    cochinweb
    Replies: 2 | Views: 196
    Last post by cochinweb, 08-20-2016, 02:44 PM
  3. karlkoeller
    nairprasad7
    Replies: 5 | Views: 603
    Last post by nairprasad7, 08-19-2016, 11:10 AM
  4. agelinajohly
    ElixantTechnology
    Replies: 6 | Views: 2188
    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!