Apache .htaccess and httpd.conf have the power to send and manipulate HTTP Header Requests and responses like sending P3P privacy headers, Content-Type: UTF-8, Content-Language: en-US, etc. The power is immense and you can do some really cool stuff with HTTP Headers!

Check out my advanced HTTP Header Viewer and Manipulator - Free Online Tool.

Table of Contents

  1. Introduction
    1. Custom HTTP Headers
      1. 100% Prevent Files from being cached
      2. Remove IE imagetoolbar
      3. Add P3P Privacy Headers to your site
      4. Add a "en-US" language header and "UTF-8" without meta tags!
        1. Using AddType
        2. Using the Files Directive
        3. Using the FilesMatch Directive

Custom HTTP Headers

Any time you see a meta tag of type "http-equiv" you can replace it with a real header in htaccess

100% Prevent Files from being cached

This is similar to how google ads employ the header Cache-Control: private, x-gzip-ok="" to prevent caching of ads by proxies and clients.


FileETag None

Header unset ETag
Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"


Remove IE imagetoolbar



Header set imagetoolbar "no"


Add P3P Privacy Headers to your site

Adding a P3P header to your site is a good idea, do this.


Header set P3P "policyref="/w3c/p3p.xml", CP="NOI DSP COR NID CUR ADM DEV OUR BUS""

# OR THIS, SIMPLER
Header set P3P "policyref="/w3c/p3p.xml""

Add a "en-US" language header and "UTF-8" without meta tags!

Article: Setting Charset in htaccess

AddDefaultCharset UTF-8
AddLanguage en-US .html .htm .css .js

Using AddType

AddType 'text/html; charset=UTF-8' .html

Using the Files Directive

Article: Using 'Files' in htaccess


AddDefaultCharset UTF-8
DefaultLanguage en-US

Using the FilesMatch Directive

Article: Using 'FilesMatch' in htaccess


AddDefaultCharset UTF-8
DefaultLanguage en-US

Manipulating HTTP Headers with htaccess - AskApache

Charles Torvalds
10 Apr 2007

Header, Htaccess

  • Site Map WireShark GNU Non-GNU Tor Project cURL TLDP - Documentation
  • Htaccess Files Hacking Htaccess Javascript Linux Optimization PHP Security Shell Scripting WordPress
  • Base64 Image Converter Raw HTTP Header Debugger Graphical ASCII Text Generator Mac Address Vendor Lookup Who Am I – Your IP Information Request Method Security Scanner .htpasswd file Generator Compress CSS DNS Tracer
Copyright © 2025 AskApache
  • Site Map
  • Htaccess Files
  • Hacking
  • Htaccess
  • Javascript
  • Linux
  • Optimization
  • PHP
  • Security
  • Shell Scripting
  • WordPress
  • Base64 Image Converter
  • Raw HTTP Header Debugger
  • Graphical ASCII Text Generator
  • Mac Address Vendor Lookup
  • Who Am I – Your IP Information
  • Request Method Security Scanner
  • .htpasswd file Generator
  • Compress CSS
  • DNS Tracer
Exit mobile version