<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Generic non-www to www (and vice versa) 301 redirect using .htaccess</title>
	<atom:link href="http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess</link>
	<description>Cake and cookies by Jippi</description>
	<lastBuildDate>Fri, 06 Nov 2009 19:47:42 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: web slc</title>
		<link>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess/comment-page-1#comment-10743</link>
		<dc:creator>web slc</dc:creator>
		<pubDate>Fri, 06 Nov 2009 19:47:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakephp.nu/?p=23#comment-10743</guid>
		<description>You can make exceptions to directories using: RewriteCond %{REQUEST_URI} !^/directory_name/</description>
		<content:encoded><![CDATA[<p>You can make exceptions to directories using: RewriteCond %{REQUEST_URI} !^/directory_name/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tim</title>
		<link>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess/comment-page-1#comment-9488</link>
		<dc:creator>tim</dc:creator>
		<pubDate>Sun, 16 Aug 2009 16:39:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakephp.nu/?p=23#comment-9488</guid>
		<description>Thanks so much about that tip for taking the caps lock off when they type it that way.  It wasn&#039;t working for users with caps lock on.  Really helpful.</description>
		<content:encoded><![CDATA[<p>Thanks so much about that tip for taking the caps lock off when they type it that way.  It wasn&#8217;t working for users with caps lock on.  Really helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paginas Web Lima</title>
		<link>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess/comment-page-1#comment-8544</link>
		<dc:creator>Paginas Web Lima</dc:creator>
		<pubDate>Fri, 03 Jul 2009 23:18:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakephp.nu/?p=23#comment-8544</guid>
		<description>For the people that don&#039;t understand what this page is about, allthough it is highly precious stuff. Each website has 2 different URL&#039;s, with the www in front, and also without www, searchengines see these as two different pages, that means by re-direct one of them to the other, you can effectively consolidate all of your link popularity to a single URL.</description>
		<content:encoded><![CDATA[<p>For the people that don&#8217;t understand what this page is about, allthough it is highly precious stuff. Each website has 2 different URL&#8217;s, with the www in front, and also without www, searchengines see these as two different pages, that means by re-direct one of them to the other, you can effectively consolidate all of your link popularity to a single URL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GiB</title>
		<link>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess/comment-page-1#comment-8183</link>
		<dc:creator>GiB</dc:creator>
		<pubDate>Mon, 22 Jun 2009 20:11:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakephp.nu/?p=23#comment-8183</guid>
		<description>Apart the hardcoding of the domain, what if we cannot use .htaccess?

Is this PHP solution leading to the same solution?

$uniqueHost = &#039;www.myWebSite.com&#039;;
if (isset($_SERVER[&quot;HTTP_HOST&quot;])) {
	if ($_SERVER[&quot;HTTP_HOST&quot;] != $uniqueHost) {
		if (isset($_SERVER[&quot;REQUEST_URI&quot;])) {
			$redirect = &#039;http://&#039;.$uniqueHost.$_SERVER[&quot;REQUEST_URI&quot;];
		}
		else {
			$redirect = &#039;http://&#039;.$uniqueHost;
		}
		header(&quot;HTTP/1.1 301 Moved Permanently&quot;);
		header(&quot;Location: &quot;.$redirect);
		exit;
	}
}</description>
		<content:encoded><![CDATA[<p>Apart the hardcoding of the domain, what if we cannot use .htaccess?</p>
<p>Is this PHP solution leading to the same solution?</p>
<p>$uniqueHost = &#8216;www.myWebSite.com&#8217;;<br />
if (isset($_SERVER["HTTP_HOST"])) {<br />
	if ($_SERVER["HTTP_HOST"] != $uniqueHost) {<br />
		if (isset($_SERVER["REQUEST_URI"])) {<br />
			$redirect = &#8216;http://&#8217;.$uniqueHost.$_SERVER["REQUEST_URI"];<br />
		}<br />
		else {<br />
			$redirect = &#8216;http://&#8217;.$uniqueHost;<br />
		}<br />
		header(&#8220;HTTP/1.1 301 Moved Permanently&#8221;);<br />
		header(&#8220;Location: &#8220;.$redirect);<br />
		exit;<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin</title>
		<link>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess/comment-page-1#comment-8130</link>
		<dc:creator>Robin</dc:creator>
		<pubDate>Sat, 20 Jun 2009 21:35:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakephp.nu/?p=23#comment-8130</guid>
		<description>Good solution. htaccess is a wonderful thing is it not! I really should get a list of these together for quick reference..</description>
		<content:encoded><![CDATA[<p>Good solution. htaccess is a wonderful thing is it not! I really should get a list of these together for quick reference..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: primeminister</title>
		<link>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess/comment-page-1#comment-4264</link>
		<dc:creator>primeminister</dc:creator>
		<pubDate>Fri, 13 Feb 2009 10:09:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakephp.nu/?p=23#comment-4264</guid>
		<description>and for someone who accidentally forgot to turn off caps-lock:

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]</description>
		<content:encoded><![CDATA[<p>and for someone who accidentally forgot to turn off caps-lock:</p>
<p>RewriteCond %{HTTP_HOST} !^www\. [NC]<br />
RewriteRule (.*) <a href="http://www.%">http://www.%</a>{HTTP_HOST}/$1 [R=301,L]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: primeminister</title>
		<link>http://www.cakephp.nu/quick-tip-generic-nonwww-www-vice-versa-301-redirect-htaccess/comment-page-1#comment-4263</link>
		<dc:creator>primeminister</dc:creator>
		<pubDate>Fri, 13 Feb 2009 10:06:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.cakephp.nu/?p=23#comment-4263</guid>
		<description>Nice one! I did the same for couple of projects but this is much better</description>
		<content:encoded><![CDATA[<p>Nice one! I did the same for couple of projects but this is much better</p>
]]></content:encoded>
	</item>
</channel>
</rss>
