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
    52
    Thanks
    1
    Thanked 14 Times in 8 Posts
    Thumbs Up/Down
    Received: 37/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 Web Hosting & VPS
    cPanel | LiteSpeed | Cloud Linux | 100% SSD | FREE SSL | OpenVZ | DDoS Protected | 99.99% 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
    187
    Thanks
    105
    Thanked 20 Times in 18 Posts
    Thumbs Up/Down
    Received: 29/0
    Given: 195/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
    240
    Thanks
    21
    Thanked 11 Times in 11 Posts
    Thumbs Up/Down
    Received: 92/0
    Given: 33/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
    52
    Thanks
    1
    Thanked 14 Times in 8 Posts
    Thumbs Up/Down
    Received: 37/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
    187
    Thanks
    105
    Thanked 20 Times in 18 Posts
    Thumbs Up/Down
    Received: 29/0
    Given: 195/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
    52
    Thanks
    1
    Thanked 14 Times in 8 Posts
    Thumbs Up/Down
    Received: 37/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 Web Hosting & VPS
    cPanel | LiteSpeed | Cloud Linux | 100% SSD | FREE SSL | OpenVZ | DDoS Protected | 99.99% 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
    722
    Thanks
    65
    Thanked 218 Times in 163 Posts
    Thumbs Up/Down
    Received: 443/1
    Given: 191/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
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thumbs Up/Down
    Received: 7/0
    Given: 0/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
    Gecko
    Replies: 11 | Views: 317
    Last post by Gecko, 01-12-2017, 06:33 AM
  2. energizedit
    HostXNow
    Replies: 3 | Views: 241
    Last post by HostXNow, 01-07-2017, 06:28 PM
  3. JoeTaxpayer
    intqc[dot]in
    Replies: 7 | Views: 250
    Last post by intqc[dot]in, 01-13-2017, 07:37 AM
  4. JoeTaxpayer
    Web hosting to run web tools?
    By JoeTaxpayer in forum Web Hosting
    sh-admin
    Replies: 1 | Views: 167
    Last post by sh-admin, 01-07-2017, 03:09 AM
  5. Mujkanovic
    What does drwxr-sr-x mean?
    By Mujkanovic in forum Web Hosting
    LJSHost
    Replies: 1 | Views: 226
    Last post by LJSHost, 01-07-2017, 02:54 AM

Older Threads

  1. EcommIndiaCloudIT
    EcommIndiaCloudIT
    Replies: 0 | Views: 80
    Last post by EcommIndiaCloudIT, 01-06-2017, 02:56 PM
  2. Chris Worner
    Chris Worner
    Replies: 6 | Views: 255
    Last post by Chris Worner, 01-06-2017, 02:59 PM
  3. Moebuntu
    RDO Servers
    Replies: 3 | Views: 424
    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: 617
    Last post by HostYourNet-DR, Yesterday, 10:28 AM
  5. Vishnu
    Vishnu
    Replies: 0 | Views: 109
    Last post by Vishnu, 01-06-2017, 08:11 AM

Latest Threads

  1. Namerie
    24x7CSM
    Replies: 2 | Views: 14
    Last post by 24x7CSM, Today, 03:39 AM
  2. uniwebhosting
    uniwebhosting
    Replies: 0 | Views: 36
    Last post by uniwebhosting, Yesterday, 11:04 PM
  3. uniwebhosting
    uniwebhosting
    Replies: 0 | Views: 22
    Last post by uniwebhosting, Yesterday, 06:49 PM
  4. NickR
    eva2000
    Replies: 2 | Views: 50
    Last post by eva2000, Yesterday, 09:38 PM
  5. Semayra
    Gecko
    Replies: 3 | Views: 24
    Last post by Gecko, Yesterday, 11:57 PM

Similar Threads

  1. Gecko
    GswHosting
    Replies: 4 | Views: 214
    Last post by GswHosting, 08-29-2016, 12:01 PM
  2. Maxoq
    cochinweb
    Replies: 2 | Views: 169
    Last post by cochinweb, 08-20-2016, 02:44 PM
  3. karlkoeller
    nairprasad7
    Replies: 5 | Views: 595
    Last post by nairprasad7, 08-19-2016, 11:10 AM
  4. agelinajohly
    ElixantTechnology
    Replies: 6 | Views: 2149
    Last post by ElixantTechnology, 11-30-2014, 10:46 AM
  5. sanusense
    ironcladservers
    Replies: 2 | Views: 1539
    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!