__.htaccess 文件中用于保护网站的标头__
祝大家有美好的一天,周末有一个美好的开始:)
我在 htaccess 文件中设置了下一个标题:
# Security Headers
<IfModule mod_headers.c>
- Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
- Header set X-Permitted-Cross-Domain-Policies "none"
- Header set X-XSS-Protection "1; mode=block"
- Header set X-Frame-Options "deny"
- Header set X-Content-Type-Options "nosniff"
- Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
- # Header set Content-Security-Policy ...
- Header set Referrer-Policy "no-referrer"
- Header set Feature-Policy "geolocation 'self'; vibrate 'none'"
</IfModule>
但是当我在“securityheader”上扫描我的网站时,它显示所有标题为红色。这意味着该网站不安全。
如果有人喜欢/可以告诉我错误,我将非常感激?
谢谢你和 此致
I wish you all a good day and a nice start in the Weekend :)
I set the next Headers in htaccess-file:
# Security Headers
<IfModule mod_headers.c>
- Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
- Header set X-Permitted-Cross-Domain-Policies "none"
- Header set X-XSS-Protection "1; mode=block"
- Header set X-Frame-Options "deny"
- Header set X-Content-Type-Options "nosniff"
- Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
- # Header set Content-Security-Policy ...
- Header set Referrer-Policy "no-referrer"
- Header set Feature-Policy "geolocation 'self'; vibrate 'none'"
</IfModule>
but when i scan my Website on "securityheader" it shows all the headers in red color. It means the website is not secure.
I would be so thankful, if someone likes/can show me the error?
Thank you and
Best regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
到目前为止,没人提到,您必须在每个标头之前删除 dashes !
我可以推荐 immuniweb 用于测试网站安全性。它会告诉您哪个标头不够严格,哪些已经过时以及如何改进。
.htaccess
中的配置太多,降低了站点的速度,因此,如果任何标题过时,则在下面的评论。或带有UP2DATE标题:
As so far nobody mentioned it, you have to remove the dashes before each header!
I can recommend Immuniweb for testing the sites security. It will tell you which header is not strict enough, which are outdated and how to improve.
Too many configs in the
.htaccess
reduce the sites speed, so if anything of the headers is outdated comment it below.or with the up2date headers: