<?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>SiteShrine Blog &#187; htaccess redirection</title>
	<atom:link href="http://siteshrine.net/tag/htaccess-redirection/feed/" rel="self" type="application/rss+xml" />
	<link>http://siteshrine.net</link>
	<description></description>
	<lastBuildDate>Fri, 10 Jun 2011 17:08:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>.htaccess Redirect</title>
		<link>http://siteshrine.net/2009/12/31/htaccess-redirect/</link>
		<comments>http://siteshrine.net/2009/12/31/htaccess-redirect/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 14:06:37 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[.htaccess redirect]]></category>
		<category><![CDATA[301 redirect]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[htaccess redirection]]></category>

		<guid isPermaLink="false">http://siteshrine.net/?p=223</guid>
		<description><![CDATA[The easiest way to redirect your visitors from one site to another or one page to another is to use an .htaccess redirect. This has no delay since before a page is loaded in the browser the server first checks for an .htaccess file. If an htaccess then is detected the old page/site never loads, [...]]]></description>
			<content:encoded><![CDATA[<p>The easiest way to redirect your visitors from one site to another or one page to another is to use an .htaccess redirect. This has no delay since before a page is loaded in the browser the server first checks for an .htaccess file. If an htaccess then is detected the old page/site never loads, instead visitors are sent directly to the new page/site.</p>
<p>Here are a few well documented methods to redirect:</p>
<h3>Important notes about htaccess redirection</h3>
<ol>
<li>Always be sure to upload .htaccess files in ascii mode, loading it in binary will cause it to not function.</li>
<li>.htaccess only works on a Linux server.</li>
<li>Make sure you triple check your changes. Clear your cache and look, test the server headers to make sure you see a 301 (that means its permanent) not a 302 (temporary) unless you are absolutely sure you really mean temporary.</li>
<li>Since some operating systems don&#8217;t allow you to make a file without something before the &#8220;.&#8221; you may need to save it as something.htaccess, some may even have to save it as htaccess.txt and change it once you&#8217;ve uploaded it.</li>
<li> Make sure your ftp program will show .htaccess files (<a href="http://sourceforge.net/projects/filezilla">FileZilla</a> does and is free).</li>
<li>Double check that you&#8217;re not overwriting an old htaccess (some servers already place one there for your custom 404 pages etc.)</li>
<li> Make sure you replace sample.com with your own sites URL</li>
</ol>
<h2>301 Redirect Examples</h2>
<h3>To Move a single page</h3>
<div><textarea cols="65" rows="2">Redirect 301 /oldpage.html http://www.example.com/newpage.html </textarea></div>
<h3>To Move an entire site</h3>
<div><textarea cols="65" rows="2">Redirect 301 / http://www.example.com/ </textarea></div>
<h3>Changed file extension?</h3>
<p>This example is perfect if you&#8217;ve decided to switch to .php from .html pages. It will look for any .html page and redirect it to .php (ie http://www.example.com/yourpage.html and redirect it to http://www.example.com/yourpage.php). Be careful with this, it does mean <em>any</em> html page.</p>
<div><textarea cols="65" rows="2">RedirectMatch 301 (.*).html$ http://www.example.com$1.php </textarea></div>
<h3>Redirect www to non www version of site</h3>
<p>It&#8217;s best to stick with either always using www.example.com or just example.com. Allowing both can confuse the search engines. So here&#8217;s how to force your site to always show the non-www version. (Search for &#8220;canonical url errors&#8221; in your favorite search engine for more info.)</p>
<p><strong>Note:</strong> If you do use either of the next 2 codes below, and use a secure server (ie. https:) be sure to check that it <em>doesn&#8217;t</em> redirect the secure to the insecure version.</p>
<div><textarea cols="65" rows="5">Options +FollowSymLinks  RewriteEngine on RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^example.com RewriteRule (.*) http://example.com/$1 [R=301,L] </textarea></div>
<h3>Redirect non-www to www</h3>
<p>Same as above except in the reverse, this one forces the www. into your url.</p>
<div><textarea cols="65" rows="5">Options +FollowSymLinks  RewriteEngine on  RewriteCond %{HTTP_HOST} ^yoursite.com [NC]  RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301] </textarea></div>
<h3>Redirect example.com/index.php to example.com/</h3>
<p>Another snippet that is a good idea to make sure search engines don&#8217;t give you a duplicate content penalty, this will also redirect example.com/folder/index.php to example.com/folder/.</p>
<div><textarea cols="65" rows="5">Options +FollowSymLinks RewriteEngine on # index.php to / RewriteCond %{THE_REQUEST} ^[A-Z]{3, 9} /.*index.php HTTP/ RewriteRule ^(.*)index.php$ /$1 [R=301,L] </textarea></div>
<img src="http://siteshrine.net/?ak_action=api_record_view&id=223&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://siteshrine.net/2009/12/31/htaccess-redirect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

