I'm trying to get a site ready for chrome's hsts preload list but i'm getting an error from the checking tool at https://hstspreload.appspot.com. The first issue is that I need to redirect all non-https to https followed by redirecting non-www to www subdomain. I can do it the otherway around (redirect non-www to www then send everything to https) but the preload tool wants it the other way around! I've tried a combination of using the redirects built into ISPConfig and other directives in the sites Apache Directives options but I just can't get it to work. Any help appreciated.
Looking at the directives written to the vhost file, they are in the reverse order that you need, as you indicate - you'll have to use custom directives to change that for now, and probably add a a feature request to the issue tracker. It's untested, but you can probably leave the HTTP -> HTTPS redirect enabled, and just do the non-www -> www redirect in custom directives (or .htaccess file even).
I intended to redirect non-www to www and http to https. For that I have used below code and it's resolving perfectly. Please check whether code is correct or not. RewriteEngine On RewriteBase / #Redirect non-www to www RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # Redirect to HTTPS RewriteCond %{HTTPS} off RewriteRule (.*) https://www.pnrstatusbuzz.in/ %{REQUEST_URI} Thank You.
Thanks for the reply Ryan but your code is the wrong way around for what I needed. If you want to add your domain to chromes HSTS preload list then you must redirect to HTTPS first and then redirect non-www to www. This can be done as Jesse suggested above.