<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Trevor Power &#187; www</title>
	<atom:link href="http://blog.trevorpower.com/index.php/tag/www/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.trevorpower.com</link>
	<description>Software development and other thoughts</description>
	<lastBuildDate>Fri, 20 Aug 2010 07:33:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>No WWW</title>
		<link>http://blog.trevorpower.com/index.php/no-www/</link>
		<comments>http://blog.trevorpower.com/index.php/no-www/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 22:40:00 +0000</pubDate>
		<dc:creator>trevorpower</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[OpenID]]></category>
		<category><![CDATA[www]]></category>

		<guid isPermaLink="false">http://trevorpower.com/blog/?p=20</guid>
		<description><![CDATA[I have never really thought about it before, but I hardly ever type &#8216;WWW&#8217; into an address bar. Out of habit I skip this part of any URL. It has never caused me any problems till this week, for one of my own websites.
As I&#8217;ve said in an earlier post, I have added OpenID support [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;"><a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.trevorpower.com%2Findex.php%2Fno-www%2F"><img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.trevorpower.com%2Findex.php%2Fno-www%2F" height="61" width="51" /></a></div><p>I have never really thought about it before, but I hardly ever type &#8216;WWW&#8217; into an address bar. Out of habit I skip this part of any URL. It has never caused me any problems till this week, for one of my own websites.</p>
<p>As I&#8217;ve said in an earlier post, I have added <span class="blsp-spelling-error" id="SPELLING_ERROR_0">OpenID</span> support to one of my websites. I used the <a href="http://code.google.com/p/dotnetopenid/"><span class="blsp-spelling-error" id="SPELLING_ERROR_1">DotNetOpenId</span></a> library. This library made the development very easy and was up and running in no time on my development machine. But recently I have published the website to a live server and things <span class="blsp-spelling-corrected" id="SPELLING_ERROR_2">haven&#8217;t</span> been going that smoothly.
<div></div>
<div>When a user provides an <span class="blsp-spelling-error" id="SPELLING_ERROR_3">OpenID</span> the <span class="blsp-spelling-error" id="SPELLING_ERROR_4">url</span> they entered must be stored on your server while the client is directed to the third party <span class="blsp-spelling-error" id="SPELLING_ERROR_5">OpenID</span> provider. This is to do with the fact that the <span class="blsp-spelling-error" id="SPELLING_ERROR_6">url</span> might redirect to another <span class="blsp-spelling-error" id="SPELLING_ERROR_7">url</span>/provider for authentication and in this case the original <span class="blsp-spelling-error" id="SPELLING_ERROR_8">ulr</span>/id may not come back when authenticated. To store the original <span class="blsp-spelling-error" id="SPELLING_ERROR_9">url</span> on the server I just bunged it into the session (I believe this is standard practice). However when I tested it on the live server I would always get an error because the session would be empty.</div>
<div></div>
<div>I then noticed that if from the error page, I try to log in again it would <span class="blsp-spelling-corrected" id="SPELLING_ERROR_10">succeed</span>. Eventually I figured out what was going on. The return address I was providing was of the form &#8216;www.mysite.com&#8217; while I always typed &#8216;<span class="blsp-spelling-error" id="SPELLING_ERROR_11">mysite</span>.com&#8217; when testing. Switching from the non &#8216;WWW&#8217; version to the &#8216;WWW&#8217; version of the <span class="blsp-spelling-error" id="SPELLING_ERROR_12">url</span> caused the session to be cleared.</div>
<div></div>
<div>Another problem is that when being authenticated by an <span class="blsp-spelling-error" id="SPELLING_ERROR_13">OpenID</span> provider, the relying party must provide a &#8216;realm&#8217; that the user is authenticated for. The realm is basically the domain of the relying party website. The problem is that &#8216;www.mysite.com&#8217; is not considered part of the &#8216;<span class="blsp-spelling-error" id="SPELLING_ERROR_14">mysite</span>.com&#8217; realm.</div>
<div></div>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://no-www.org/"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 80px; height: 15px;" src="http://no-www.org/images/blog-button.gif" border="0" alt="" /></a>
<div>This means that to keep things simple I had to decide which address I was going to use and redirect one to the other. The choice was made simple because <a href="http://no-www.org/">no-www.org</a> had some good arguments and the yes-www.org website was down (or maybe I forgot the www). </div>
<p>Redirecting turned out to be easier than I thought (I didn&#8217;t need to contact hosting provider). I just added a &#8216;.<span class="blsp-spelling-error" id="SPELLING_ERROR_15">htaccess</span>&#8216; file to the root of my directory with the following lines
<pre><span class="blsp-spelling-error" id="SPELLING_ERROR_16">RewriteEngine</span> On<span class="blsp-spelling-error" id="SPELLING_ERROR_17">RewriteCond</span> %{HTTP_HOST} ^www\.(.+)$ [NC]<span class="blsp-spelling-error" id="SPELLING_ERROR_18">RewriteRule</span> ^(.*)$ http://%1/$1 [R=301,L]</pre>
<p>This tip I got from <a href="http://no-www.org/">no-www.org</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.trevorpower.com/index.php/no-www/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

