使用.htaccess为每个请求添加标头

ste*_*ven 22 php .htaccess

我想在不触及代码的情况下为phpbb安装添加自定义标头.(使用.htaccess)

标题是:

Strict-Transport-Security: max-age=157680000
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

ste*_*ven 38

Header add Strict-Transport-Security "max-age=157680000"
Run Code Online (Sandbox Code Playgroud)

http://httpd.apache.org/docs/2.0/mod/mod_headers.html

  • 我会添加一个检查模块是否已加载.<br/> <IfModule mod_headers.c> Header add Strict-Transport-Security"max-age = 157680000"</ IfModule> (4认同)
  • 不要忘记激活apache模块头`a2enmod头`。 (2认同)

Lan*_*ing 5

请参阅http://httpd.apache.org/docs/2.0/mod/mod_headers.html

Header add Strict-Transport-Security "max-age=157680000"
Run Code Online (Sandbox Code Playgroud)

  • 不要忘记激活 apache 模块头 `a2enmod headers` (2认同)