Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Redirecting from http to https

How would you redirect from http to https?

My website is http://chemistscorner.com/forum and I'm running the latest version 2.8.1

It is still listed as http:// but I want it to be https://

My primary website runs Wordpress and it is https. How do you switch vanilla to be https?

thanks

Comments

  • Options

    Hi all, I've just installed Vanilla 2.8 and I'm trying to set it up over SSL (I've put an SSL over my domain with let's encrypt) but my site loads either on http and HTTPS, how could I force the use of only HTTPS? Thank you all

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Most probably there is a mixture of http and https requests and you have to look after the reasons for the http requests to solve the problem. Your web browser comes with some tools which give you insights on the network traffic and you will be able to see which resources are loaded via http

  • Options
    socksock
    edited March 2019

    i think lorenzo means that you can access the site via both protocols.

    you'd need to set up a redirect to forward all traffic to the https site.

    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] 
    
  • Options
    charrondevcharrondev Developer Lead (PHP, JS) Montreal Vanilla Staff
    edited March 2019

    There’s also a configuration setting Garden.ForceSSL. Then the app will always redirect to https.

  • Options

    @sock - what file would that code go into?

  • Options
    KasparKaspar Moderator

    Something weird happened in this thread - all of sudden there is posts in it made before it was made.


    @LeftBrain see my last link.

  • Options
    charrondevcharrondev Developer Lead (PHP, JS) Montreal Vanilla Staff

    I merged them together. Generally when we have 2 discussions on the exact same topic, it is best to merge them together so that they aren't competing for attention.

  • Options
    KasparKaspar Moderator

    Yea, figured it was merged.

  • Options
    ShadowdareShadowdare r_j MVP
    edited March 2019

    I like setting Garden.ForceSSL to true like @charrondev mentioned. Add this line to /conf/config.php:

    $Configuration['Garden']['ForceSSL'] = true;
    

    It forces Vanilla to redirect all routes to https. This is configuring redirection on the app-level. WordPress does this by having you set your WordPress and Site Address in the settings and only uses that URL for everything you do on it.

    This first method is optional if you also employ the other method shown earlier in this discussion: add URL rewrite rules to the .htaccess file if you're using Apache for your web server or nginx's config file if you're using nginx. This ensures that all links get forwarded to https, including links to static files (css, images, uploads, etc) as these files are handled on the server-level.

    Add Pages to Vanilla with the Basic Pages app

  • Options
    charrondevcharrondev Developer Lead (PHP, JS) Montreal Vanilla Staff

    Thanks @Shadowdare for the full code summary. I was on mobile when I made the post so it was difficult for me to put the proper example.

    Setting this type of redirect at the webserver level is definitely the best solution, but setting the configuration at the application level is also sufficient, and, since all of vanilla tries to respect that configuration setting, most URLs created by the application should be https.

  • Options
    FmslickFmslick Texas New

    I just wanted to add to this post!

    .htaccess

        RewriteCond %{HTTPS} !=on
        RewriteRule ^/?(.*) https://www.%{SERVER_NAME}/$1 [R,L]
    

    Note: its SERVER_NAME and not HTTP_HOST , this maybe due to my host is using Lightspeed.

    Yes config.php has Allow and ForceSSL is on.

    $Configuration['Garden']['AllowSSL'] = true;   
    $Configuration['Garden']['ForceSSL'] = true;
    

    https://open.vanillaforums.com/discussion/37170/help-with-ssl#latest

  • Options
    edited April 2019

    If someone is still having trouble:

    I've solved everything putting this on the top of my htaccess file

    # BEGIN SSL

    RewriteEngine On 

    RewriteCond %{HTTP_HOST} ^forum.nuotounostiledivita.it [NC]

    RewriteCond %{SERVER_PORT} 80 

    RewriteRule ^(.*)$ https://yourforum.com/$1 [R,L]

  • Options

    This solution did not work for me. Any idea what I did wrong?


    I put the following code in my config.sys

    $Configuration['Garden']['AllowSSL'] = true;  

    $Configuration['Garden']['ForceSSL'] = true;


    And I put the following code in my .htaccess


    # BEGIN SSL

    RewriteEngine On 

    RewriteCond %{HTTP_HOST} ^thebeautybrains.com/bbforum [NC]

    RewriteCond %{SERVER_PORT} 80 

    RewriteRule ^(.*)$ https://thebeautybrains.com/bbforum/$1 [R,L]

  • Options

    I honestly don't know, anyway I'm pretty sure that could depend also on the hosting server you're, I've found different solutions on different hosting websites

Sign In or Register to comment.