Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 621
  • Last Modified:

Apache Set Response Header if nonexistent

Hi everybody,

how can I set a certain header in my response ONLY IF it doesn't exist?

More precisely, I want to set "Content-Encoding: identity" only in case that it doesn't exist already. If it does, it should keep its original value (e.g. "Content-Encoding: gzip")

Thanks in advance
Dani
0
kickeronline
Asked:
kickeronline
1 Solution
 
kivan24Commented:
Maybe:
if (strstr($_SERVER["HTTP_ACCEPT_ENCODING"],"identity")===0) {
    // set to et identity
} else {
    //keep its original value
}

Open in new window

0
 
kickeronlineAuthor Commented:
Sorry, I'm searching more kind of a apache configuration for a vhost. I got to admit I could have chosen a better category :-/
0
 
hernst42Commented:
Have you looked at http://httpd.apache.org/docs/2.2/en/mod/mod_headers.html Should be something like:

Header merge Content-Encoding identity
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now