I have an SSL cert installed for hardtofindbooks.com, however if a visitor types in www.hardtofindbooks.com the certificate throws up an error. I'm thinking I could do a redirect if the URL includes a www, but can't find a way to test this.
$SERVER_NAME shows the server name on Apache, which is without the www, but an httpd alias entry allows the inclusion. $parse_url requires the url to be input, which is what I can't find how to get out.
So in short, how can I test if somebody has typed in http://www.hardtofindbooks.com instead of http://hardtofindbooks.com?