Results 1 to 3 of 3

Thread: (Solved) How to force https instead of http ?

  1. #1
    User
    Join Date
    04-01-10.
    Posts
    289

    Frage (Solved) How to force https instead of http ?

    Hi everyone,

    I got a website under Contao 3.5 on a shared host. I've activated ssl for having https access. I'd like to know how I can force http access automatically routed to https.
    OVH (my host) gives two way :
    - create a redirection in its manager ; I've tried, this wasn't a great success for now…
    - or add this lines in .htaccess
    Code:
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.votredomaine.fr/$1 [R=301,L]
    Can I add this in Contao's 3.5 .htaccess ? In which part ?

    Thanks
    Last edited by charled; 02/06/2017 at 15:12.

  2. #2
    User Spooky's Avatar
    Join Date
    01-03-13.
    Posts
    339

    Default

    Yes, simply add
    Code:
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.votredomaine.fr/$1 [R=301,L]
    here for example.

    Alternative:
    Code:
    RewriteCond %{HTTPS} off
    RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

  3. #3
    User
    Join Date
    04-01-10.
    Posts
    289

    Default

    Perfect. thanks.

    This be could be added # but commented # in Contao's htaccess (perhaps is it in Contao's 4).

Bookmarks

Posting Permissions

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