![]() |
Apache add Response Header based off of requested URI
I need to insert a response header for my homepage. My site utilizes Wordpress (which isn't terribly relevant) but the fact that Wordpress relies heavily on mod_rewrite is. The homepage gets access at http://www.example.com/ however Wordpress rewrites the request to http://www.example.com/index.php. I tried using a LocationMatch directive in conjunction with a Headers like this:
Code:
<LocationMatch "^/$">Code:
<LocationMatch "^/index.php$">LocationMatch seems to apply to the finally requested URI after mod_rewrite is done with it. I need a directive like <Orignally_Requested_URI>. Ideas? |
Problem Solved
I managed to solve my own problem. I don't know if it's the most efficient way or not, but it's working the way I want.
Using mod_rewrite I check to see if the originally requested URI equals "^/$" and if it does I set an environment variable named "ISHOMEPAGE" to 1. Then I can set the header based on whether or not that environment variable exists. Code:
RewriteEngine On |
| All times are GMT -5. The time now is 03:19 AM. |