htaccess Missing Security Headers — Adding them broke the site
-
I followed the guide here: https://really-simple-ssl.com/site-health-recommended-security-headers/
But did so by editing the document through a plugin that makes backups of the .htaccess file and checks it for syntax errors (WP htaccess editor). I added what’s on the walkthrough exactly as directed and it matches what’s at the end, and the plugin said there was a syntax error. I said, eh, whatever, it makes a backup, lemme try anyway…sure enough, 500 error, had to roll back. I downloaded what the plugin put out as the htaccess file and the contents matched what I had expected, at least.
This is what I was trying to use:
# BEGIN rlrssslReallySimpleSSL rsssl_version[4.0.15] Header always set Strict-Transport-Security: "max-age=31536000" env=HTTPS Header always set Content-Security-Policy "upgrade-insecure-requests" Header always set X-Content-Type-Options "nosniff" Header always set X-XSS-Protection "1; mode=block" Header always set Expect-CT "max-age=7776000, enforce" Header always set Referrer-Policy: "no-referrer-when-downgrade" <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTPS} !=on [NC] RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] </IfModule> # END rlrssslReallySimpleSSL # BEGIN WordPress # The directives (lines) between "BEGIN WordPress" and "END WordPress" are # dynamically generated, and should only be modified via WordPress filters. # Any changes to the directives between these markers will be overwritten. <IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
I notice each of the security lines provided don’t have a : between <thing to change> and <thing to change it to>, but I don’t know enough to know if that’s accurate.
Am I in a situation where I need to do this instead — https://really-simple-ssl.com/security-headers-on-nginx/ ?
Edit: URL if it matters — https://sukidesu.live
- The topic ‘htaccess Missing Security Headers — Adding them broke the site’ is closed to new replies.