“This site does not support Microsoft”

Have you ever wanted Windows and/or Internet Explorer users to feel your irritation when a site tells you it doesn’t support Linux?  Well, a few lines of php in your index page will spread the pain.

Now, my server, such as it is, is in my house and I do not get much if any traffic from Windows users.  Actually, I don’t even want the hits, as I really try to stay off the radar.  So what would block about 90% of the internet off my server unless they’re in the Linux club (or Mac, but they don’t have scads of market share either).

In my index.html, I stick this at the top:

if (eregi(“Windows”,getenv(“HTTP_USER_AGENT”)) ||
eregi (“MSIE”,getenv(“HTTP_USER_AGENT”)) ||
eregi(“Internet Explorer”,getenv(“HTTP_USER_AGENT”))) {
Header(“Location: windows.txt”);

I rename the file from index.html to index.php.  I also create a terse message in /var/www/html named windows.txt:

This site does not support Microsoft.

And now only Linux (or Mac) users can go to my server’s index page!  That’ll show you, people who never go to my server anyway.

Now, you might be thinking, “What if you have to borrow your Mom’s laptop to access a file?”  Duh, it’s only the home page in the Apache root that redirects.  I can still go to http://mysite/anna or other subdirectories of /var/www/html just fine.

One thought on ““This site does not support Microsoft””

  1. Found out that eregi will soon be deprecated for newer version of PHP, but this works currently and will for newer versions. Replace all the eregi lines with just this.

    if(preg_match('#[wW]indows|MSIE|[iI]nternet [eE]xplorer#',$_SERVER['HTTP_USER_AGENT'])) {

Leave a Reply