mod_headers not working
Asked Answered
F

2

8

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!

Foret answered 29/8, 2011 at 3:11 Comment(6)
Are you trying to run .x as .php?Gelsemium
yes,it works. My problem is with mod_headers.c.Foret
because you can simply use the addType and you can get rid of mod_headers. Do you absolutely need mod_headers?Gelsemium
here's a link I found that might help you askapache.com/htaccess/…Gelsemium
What happens or doesn't happen? Do you get an error?Tarsal
I believe that the FilesMatch directive does the match on the rewritten URL, not the original one. Therefore it never matches and never executes the Header directive.Hadji
M
12

Try loading the headers module with

sudo a2enmod headers 
sudo service apache2 restart
Mineralogy answered 26/3, 2014 at 8:29 Comment(0)
N
0

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.

Newsdealer answered 25/5, 2020 at 19:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.