简体   繁体   中英

mod_headers not working

I enable mod_headers and mod_rewrite in my http.config removing the # from line.

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.

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

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. But first make sure that mod_headers is already installed and working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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