A Brief Peek into The World of .htaccess
Summary
I’ve been saying it to my colleagues for years – “Don’t put loads of redirects in .htaccess, it’ll just slow the site down” but never had any actual evidence to back that claim up. I was curious about how much of an impact .htaccess files can actually have on the speed of a site, so I decided to run a few simple tests to try and gain some understanding of how much difference it can make. When we set AllowOverride to All, which allows the use of .htaccess but don’t actually add a .htaccess file to the document root, we see this: TpR has increased a little to 0.299ms, and RpS has decreased a little to 3342.68. That compares with a TpR of 0.288ms and RpS of 3473.61 from our first test (1.73% and -1.80% difference respectively) which feels close enough to our original values to rule out anything unconsidered having a cumulative effect somewhere. Sure, it can make deployments a bit trickier at times, and you probably won’t have write access to the configuration files, so you’ll need to ask your friendly sys-admin for help.