Git Product home page Git Product logo

Comments (4)

lgarron avatar lgarron commented on May 27, 2024

Redirect to HTTPS first:

RewriteCond %{HTTPS} off
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,L]

If you want the main site on the www subdomain, redirect to www once you're on HTTPS:

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^acmewidgets\.com$ [NC]
RewriteRule ^(.*)$ https://www.acmewidgets.com/$1 [L,R=301]

EDIT: Fix regex, as described below

from hstspreload.org.

jaffacakerhubarb avatar jaffacakerhubarb commented on May 27, 2024

Thanks for the pointers. I have tried setting my .htaccess like that, but it doesn't seem to work. If I set it as follows:

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS

RewriteCond %{HTTPS} off
RewriteRule ^/?(.*) https://%{HTTP_HOST}/$1 [R,L]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} acmewidgets.com [NC]
RewriteRule ^(.*)$ https://www.acmewidgets.com/$1 [L,R=301]

Then the page itself refuses to load due to 'too many redirects', and the HSTS preload page gives me this error twice: 'There are more than 3 redirects starting from http://acmewidgets.com.'

Am I coding this in wrong?

from hstspreload.org.

lgarron avatar lgarron commented on May 27, 2024

Then the page itself refuses to load due to 'too many redirects', and the HSTS preload page gives me this error twice: 'There are more than 3 redirects starting from http://acmewidgets.com.'

Whoops, I think the second-to-last line needs to be:

`RewriteCond %{HTTP_HOST} ^acmewidgets.com$ [NC]`

from hstspreload.org.

lgarron avatar lgarron commented on May 27, 2024

Closing this, since it's not a bug to do with the submission site.

from hstspreload.org.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.