Solved

Apache Set Response Header if nonexistent

Posted on 2011-02-25
3
589 Views
Last Modified: 2012-05-11
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
Comment
Question by:kickeronline
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 8

Expert Comment

by:kivan24
ID: 34978612
Maybe:
if (strstr($_SERVER["HTTP_ACCEPT_ENCODING"],"identity")===0) {
    // set to et identity
} else {
    //keep its original value
}

Open in new window

0
 

Author Comment

by:kickeronline
ID: 34978634
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
 
LVL 48

Accepted Solution

by:
hernst42 earned 250 total points
ID: 34979969
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

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question