Andrew McCombe


Full Stack Web Developer

Apache: Use .htaccess to redirect non-www to www

Sometimes your website will be set up to serve your site on both www.domain.com and also domain.com. Search engines will see this as two separate sites (unless you have a rel=”canonical” tag) and this may have a negative effect on your SEO rankings. The best way to avoid this is to make sure you serve […]


Apache: Use .htaccess to redirect http to https

I’m forever having to lookup how to use Apache’s .htaccess to redirect http to https so here it is. First, make sure you have Apache’s mod_rewrite module enabled.

This will check the request for HTTPS and if it matches will permanently redirect the browser to the https:// url.


How to use htaccess to password protect your website

There are many reasons why you would want to password protect your website, or a section of your website. Here’s how to setup a .htaccess file to password protect your website.


Grep Apache access log for browser and OS version

Today I’ve needed to find out if it was worth testing a client’s website with Safari 5 on Windows. Here’s some shell foo to find out from an access log


Filter Apache logs to exclude js, css and images

Quite often I find myself having to filter Apache logs to exclude JS, CSS and images. I use a combination of cat and egrep to achieve this.


Vagrant PHP and PuPHPet is the Dogs Bollocks!

In The Beginning… I’ve been a PHP Web Developer for a long long time and have spent many hours setting up development environments in order to practice my trade. From full blown towers running full cdrom installations of RedHat 6.2 through to a laptop running FreeBSD and then Slackware. I used to compile the LAMP […]


Routing requests to index.php with Apache

Routing requests to index.php with Apache Here’s how to go about routing requests to index.php with Apache. I’m always having to search for this online so I thought I’d document it here. Many of the ‘modern’ PHP applications use index.php as a router, including WordPress, Drupal, Zend Framework, Silex etc. Using Mod_Rewrite If you are […]


Restart Apache on Mac OS X Mountain Lion

This is here for reference as I keep forgetting how to restart apache on Mac OS X Mouintain Lion. Here’s how to do it:

Enter password and you’re done. You can also start and stop Apache by using the ‘start’ and ‘stop’ parameters:


Tutorial: Setting up Varnish with Apache.

Varnish is an HTTP accelerator designed for content-heavy dynamic web sites. In contrast to other HTTP accelerators, such as Squid, which began life as a client-side cache, or Apache, which is primarily an origin server, Varnish was designed from the ground up as an HTTP accelerator. Here’s how to set up varnish with Apache. Tested […]