THELIA Forum

Welcome to the THELIA support and discusssion forum

Announcement

Rejoignez la communauté sur le Discord Thelia : https://discord.gg/YgwpYEE3y3

Offline

#1 Http vers Https

(08-07-2020 12:10:15)


Dans mon dossier WEB, j'ai un fichier .htaccess avec le contenu suivant :

Options +FollowSymlinks -Indexes

AddDefaultCharset UTF-8

<IfModule mod_rewrite.c>
    RewriteEngine On

    # SEO, remove the subdomain www in URL
    # Exemple : http://www.yourdomain.com/contact redirect 301 to http://yourdomain.com/contact
    # To activate uncomment the following two lines
    #RewriteCond %{HTTP_HOST} ^www.yourdomain.com$
    #RewriteRule ^(.*) http://yourdomain.com/$1 [QSA,L,R=301]

    # SEO, add the subdomain www in URL
    # Exemple : http://yourdomain.com/contact redirect 301 to http://www.yourdomain.com/contact
    # To activate uncomment the following two lines
    #RewriteCond %{HTTP_HOST} ^yourdomain.com$
    #RewriteRule ^(.*) http://www.yourdomain.com/$1 [QSA,L,R=301]

    # SEO, to avoid duplicate content with index.php in url
    # Exemple : http://www.yourdomain.com/index.php/contact redirect 301 to http://www.yourdomain.com/contact
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteRule (.?)index\.php/(.*) /$1$2 [R=301,NE,L]

    # If thelia is installed in a subdirectory (e.g., thelia2)
    # define the RewriteBase below to get a proper URL rewriting
    # RewriteBase /thelia2

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php [QSA,L]
    RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]
</IfModule>

Puis-je le modifier par le contenu suivant afin d'avoir toujours une redirection http vers https sur mon thelia (actuellement la redirection ne se fait pas) ?

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    # First rewrite to HTTPS:
    # Don't put www. here. If it is already there it will be included, if not
    # the subsequent rule will catch it.
    RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # SEO, add the subdomain www in URL
    # Exemple : http://yourdomain.com/contact redirect 301 to http://www.yourdomain.com/contact
    # To activate uncomment the following two lines
    RewriteCond %{HTTP_HOST} ^yourdomain.fr$
    RewriteRule ^(.*)$ https://www.yourdomain.fr/$1 [QSA,L,R=301]
    ....
</IfModule>

Merci pour votre aide,

Bien cordialement,

Thierry


TS Editions Thisa

Offline

#2 Re: Http vers Https

(08-07-2020 13:22:46)


Oui, tu peux, bien sûr.


OpenStudio Toulouse

Offline

#3 Re: Http vers Https

(08-07-2020 13:30:20)


Merci roadster31,

C'est fait, ça marche nickel.

Bonne journée...


TS Editions Thisa