<?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>Master Site Manager SEO Ranking Software &#187; Htaccess Tutorial</title>
	<atom:link href="http://www.mastersitemanager.com/tag/htaccess-tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mastersitemanager.com</link>
	<description>Save hours tracking your SEO stats with Master Site Manager SEO tracking software</description>
	<lastBuildDate>Tue, 22 Feb 2011 19:39:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Setting up a URL redirect/rewrite using the .htaccess file?</title>
		<link>http://www.mastersitemanager.com/857/301-htaccess-redirect-tutorial/</link>
		<comments>http://www.mastersitemanager.com/857/301-htaccess-redirect-tutorial/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 21:52:46 +0000</pubDate>
		<dc:creator>Master Site Manager</dc:creator>
				<category><![CDATA[SEO News & Tips]]></category>
		<category><![CDATA[301 redirect]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Htaccess File]]></category>
		<category><![CDATA[Htaccess Redirect]]></category>
		<category><![CDATA[Htaccess Tutorial]]></category>
		<category><![CDATA[seo tips]]></category>
		<category><![CDATA[Url Redirect]]></category>

		<guid isPermaLink="false">http://www.mastersitemanager.com/?p=857</guid>
		<description><![CDATA[.htaccess Redirect/Rewrite Tutorial There are several reasons that you&#8217;d use a 301 redirect on your web site. Maybe you renamed  / deleted a page, or post. Typically by default &#8211; depending on how your web host has their servers set up &#8211; your web site can be accessed with both www.domain.com and domain.com. This is [...]]]></description>
			<content:encoded><![CDATA[<h2>.htaccess Redirect/Rewrite Tutorial</h2>
<p>There are several reasons that you&#8217;d use a 301 redirect on your web site. Maybe you renamed  / deleted a page, or post.</p>
<p>Typically by default &#8211; depending on how your web host has their servers set up &#8211; your web site can be accessed with both www.domain.com and domain.com.</p>
<p>This is NOT good&#8230; Why?</p>
<p>What this means is that when Google comes along to spider / index your site &#8211; it &#8220;sees&#8221; TWO identical copies of the site. Opps!</p>
<p>And because Google penalizes ON-SITE duplicate content, you should restrict the access to either www.domain.com or domain.com. In other words, you need to decide right now if you want your site to be know on the web as www.yoursite.com OR yoursite.com.</p>
<p>You can&#8217;t do both&#8230;. well you can, but Google won&#8217;t show your site the love that it deserves if you do.</p>
<p>Some links may be outside of your website scope and/or the search engines may have already indexed your website under both addresses. If that&#8217;s the case, there&#8217;s not a lot you can do about it, but setting a 301 redirect up will help.</p>
<p><strong>So the question is &#8220;How do I redirect all links for www.domain.com to domain.com ?</strong>&#8221;</p>
<p>Simply create a server side 301 redirect up in your .htaccess file. It&#8217;s not as hard as it sounds.</p>
<p>*** BEFORE making any changes, though I do recommend taking your EXISTING .htaccess file and archiving it so you have a back up in case you break something&#8230;</p>
<p><strong>Create a 301 redirect forcing all http requests to use either www.domain.com or domain.com:</strong></p>
<p>* Example 1 &#8211; Redirect domain.com to www.domain.com:</p>
<p>Simply add this code to the top of your current .htaccess file. Be sure to substitute your domain name in the code.</p>
<p style="padding-left: 30px;">RewriteEngine On<br />
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]<br />
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]</p>
<p><strong>* Example 2 &#8211; Redirect www.domain.com to domain.com:</strong></p>
<p style="padding-left: 30px;">RewriteEngine On<br />
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]<br />
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]</p>
<p><strong>Ok, let&#8217;s look at what this does with this explanation of this .htaccess 301 redirect:</strong></p>
<p>Let&#8217;s have a look at the example 1 &#8211; Redirect domain.com to www.domain.com. The first line tells apache to start the rewrite module. The next line:</p>
<p>RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]</p>
<p>specifies that the next rule only fires when the http host (that means the domain of the queried url) is not (- specified with the &#8220;!&#8221;) www.domain.com.</p>
<p>The $ means that the host ends with www.domain.com &#8211; and the result is that all pages from www.domain.com will trigger the following rewrite rule. Combined with the inversive &#8220;!&#8221; is the result every host that is not www.domain.com will be redirected to this domain.</p>
<p>The [NC] specifies that the http host is case insensitive. The escapes the &#8220;.&#8221; &#8211; because this is a special character (normally, the dot (.) means that one character is unspecified).</p>
<p>The final line describes the action that should be executed:</p>
<p>RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]</p>
<p>The ^(.*)$ is a little magic trick. Can you remember the meaning of the dot? If not, this can be any character(but only one). So .* means that you can have a lot of characters, not only one. This is what we need because ^(.*)$ contains the requested url, without the domain.</p>
<p>The next part http://www.domain.com/$1 describes the target of the rewrite rule. This is our &#8220;final&#8221; used domain name, where $1 contains the content of the (.*).</p>
<p>The next part is also important, since it does the 301 redirect for us automatically: [L,R=301]. L means this is the last rule in this run. After this rewrite the webserver will return a result. The R=301 means that the webserver returns a 301 moved permanently to the requesting browser or search engine.</p>
<p>I know this may seem pretty daunting to some who feel it&#8217;s too techniucal but it will pay off big time for you in the SERPs. If you don&#8217;t know how to do this or feel uncomfortable doing it, hire someone. It really is a &#8220;must do&#8221; for any site looking to secure top rankings.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.mastersitemanager.com%2F857%2F301-htaccess-redirect-tutorial%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://www.mastersitemanager.com/857/301-htaccess-redirect-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

