.htaccess version your static files, to help prevent sticky browser cache’s

Just the other day I was presented an issue where multiple browser types on multiple flavors of OS’s were caching styles, scripts and images in a variety of ways. We had rolled out a new version of a product, which ended up having a bug in it, and we had to roll it back to a previous state in order to fix a few things and push it back out. However, due to the flip flopping back and forth depending on the OS you were on, and the browser you were using new scripts were stuck in the cache while the old version was visible, and vis versa. It was a nightmare for a short while. But the at the end of the day it was all due to caching. Not all browsers are equal even Chrome on Mac vs Chrome on Windows vs Chrome on Linux. While they hold similar techniques, each has its own quirks. However thats a discussion for another day. Continue reading

.htaccess redirect files on a one to one basis

Lately I have been going over sites I have helped people with in the past revisiting them if you will, I have also been reevaluating some of my old sites that no longer exist yet still have the domains for. While doing this it dawned on me, that I have allowed some people to host images and other files off some of these old sites, either logos of my own, or whatever the case. Problem is when I took those sites down, either cause I moved hosting providers, or they no longer served a purpose I took everything down. Including those shared files, fortunately many of them I still have. The thing is though I wasn’t about to go into each domain folder and start creating new folders to match the file paths of those now old missing files, besides I like to keep myself organized as possible (for a coder that may seem impossible, but I try). What I wanted to do was just take a domain of mine, one I don’t really do anything with currently and or may never, but one that I know I will not likely let drop in my life time. Is take this domain and just create a folder that will act as a repo for the old files, and future files I will share with others like I have in the past. This way I don’t have to worry as much about making the same mistake twice when and if I ever take down another site.

Continue reading

How to put site in construction mode quick and easy via .htaccess

Do you run a blog like wordpress or some other CMS driven website? Or even a MVC like CakePHP or Codeigniter? Something that in essense runs solely off of index.php for the most part? Sure why not. Most sites now a days run off of a lone php file. So. A quick easy way to get your site into a maintenance or construction mode is to alter your .htaccess file by adding the next line to it (above everything else in there already).
Continue reading