Htaccess Tricks and Tips
queness.com
queness.com
Please don't do this. I would rather have my browser's default behavior for application/pdf than have your web site force it to treat your PDF files as opaque binary blobs.
One interesting thing to note is that every Apache config file will (or should have!) some lines like this in it:
<Directory />
AllowOverride None
</Directory>
If this is not there, Apache will look for a .htaccess file in every single folder starting at '/' all the way up to your document root and on into the folder of the URL being requested e.g.Your document root is here: /very/long/path/to/your/webroot
You request the following URL: "/project/files/here/file.html", which servers this file: /very/long/path/to/your/webroot/project/files/here/file.html
Without the above config settings, Apache would attempt to stat the following files each time the url "/project/files/here/file.html" is requested...
/.htaccess
/very/.htaccess
/very/long/.htaccess
/very/long/path/.htaccess
/very/long/path/to/.htaccess
/very/long/path/to/your/.htaccess
/very/long/path/to/your/webroot/.htaccess
/very/long/path/to/your/webroot/project/.htaccess
/very/long/path/to/your/webroot/project/files/.htaccess
/very/long/path/to/your/webroot/project/files/here/.htaccess
Ouch!If you have the above mentioned config in place (it's part of most default apache configs, but I have seen mis-configured servers without it), but you allow override for your webroot, you will still have the following file stats to perform for the same URL request:
/very/long/path/to/your/webroot/.htaccess
/very/long/path/to/your/webroot/project/.htaccess
/very/long/path/to/your/webroot/project/files/.htaccess
/very/long/path/to/your/webroot/project/files/here/.htaccess
Which is still rather wasteful if not absolutely necessary. Only use .htaccess files when no other option is available.General: 1. I've found using anything but GMT/UTC on servers is a recipe for confusion.
4. Great idea, but like most of the recommendations, it's not .htaccess specific. Websites should either redirect www.foo -> foo or foo -> www.foo. Presenting a consistent hostname that way can prevent some cookie-related headaches, and will avoid having search engines index different pages under different hostnames.
8. That recipe inadvertently deletes Cache-control: private
Also, deploying via export is trickier than it sounds. You can't just cd to /var/www/whatever and run "svn export" or else you'll end up with files deleted from the repository still existing on production.
Why would you do that, either? I thought it was something of a best practice to use symlinks for that sort of thing, so you could export to a new directory then change the symlink to point to the directory you just created.
At my current company we have a decent sysadmin, so things are a bit more sensible (a combination of svn export, running tests, then an rsync to our production box.)
Don't be saddened, be angry. When you do start doing stuff on the web, do it properly so other people don't have to eventually maintain the nightmare you might have created!
But also keep in mind that crappy code that ships beats perfect code that never ships every time.
Header set Strict-Transport-Security "max-age=86400"
- Let GoogleFrame do its magic:
BrowserMatch chromeframe gcf
Header append X-UA-Compatible "chrome=1" env=gcf
Say I have tomcat running on port 8080 but I want people to just go to www.site.com/tomcat