Manipulating HTTP Headers with htaccess
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.
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
« htaccess Tricks for WebmastersPHP htaccess tips and tricks »
Comments