简体   繁体   English

mod_headers 不起作用

[英]mod_headers not working

I enable mod_headers and mod_rewrite in my http.config removing the # from line.我在 http.config 中启用mod_headersmod_rewrite ,从行中删除 #。

LoadModule headers_module modules/mod_headers.so

LoadModule rewrite_module modules/mod_rewrite.so

I need enable more something or the error is on .htaccess?我需要启用更多东西还是错误在 .htaccess 上?

.htaccess. .htaccess。

RewriteEngine On
RewriteRule ^(.*?)\.x$ /$1.php [L]
<IfModule mod_headers.c>   
   <filesMatch "\.(x)$">
        Header set foo "baa"
  </filesMatch>  
</IfModule> 

Thanks in advance!提前致谢!

Try loading the headers module with尝试加载 headers 模块

sudo a2enmod headers 
sudo service apache2 restart

I resolved this problem by clearing cache of browser.我通过清除浏览器缓存解决了这个问题。 If you are looking at browser inspector of chrome then check the 'Disable Cache' in 'Network' tab.如果您正在查看 chrome 的浏览器检查器,请检查“网络”选项卡中的“禁用缓存”。 But first make sure that mod_headers is already installed and working.但首先要确保 mod_headers 已经安装并正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM