Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End CSP with SSL redirect via mod_rewrite Reply To: CSP with SSL redirect via mod_rewrite

#238893
Anoop Gupta
Participant

@alexzaworski,

You can try this code, It should be helpful.

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_USER_AGENT} ^(.+)$
RewriteCond %{SERVER_NAME} ^domain.com$
RewriteRule ^(.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
Header add Strict-Transport-Security “max-age=300”
</IfModule>

Thanks
Anoop Gupta
https://www.zeemo.com.au/