The “www” RewriteCond

March 18th, 2007 by Alistair MacDonald Leave a reply »

I have just tweaked my web site configuration (hosted by SteelPixel) so it does not redirect “agm.me.uk” to “www.agm.me.uk” but still prefixes the www to all other pages.

The reason why I have done this is because of OpenID. I use the root of my web site as an open ID as it is quick to type in and I have full control, but until now when I type in agm.me.uk my OpenID login annoyingly becomes www.agm.me.uk.

The following needed adding to the “.htaccess” file in the route of my web site for it to work. The second and third lines are those that I have just added, and you need them both for reasons that I can not currently fathom.

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/$
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteCond %{HTTP_HOST} ^agm.me.uk [NC]
RewriteRule ^(.*)$ http://www.agm.me.uk/$1 [L,R]

Naturally all this is fairly pointless in the global scheme of things, but I feel better now. I have also added a search facility for all my sites using Google Co-op that is slightly more usful.

Advertisement

1 comment

  1. Alternatively, you could just drop it.

    My OpenID is james.cridland.net – just like my website. If I had the time again, I’d make http://www.mediauk.com just point to mediauk.com – www is so web 1.0…

Leave a Reply

css.php