<?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>Roger Davies &#187; rewrite engine</title>
	<atom:link href="http://www.rogerdavies.com/tag/rewrite-engine/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rogerdavies.com</link>
	<description>The Ramblings of a Weirdo</description>
	<lastBuildDate>Sun, 08 Aug 2010 19:00:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>URL Rewriting to Make Your URLs Search Engine Friendly and Domain Forwarding</title>
		<link>http://www.rogerdavies.com/2008/08/url-rewriting-to-make-your-urls-search-engine-friendly-and-domain-forwarding/</link>
		<comments>http://www.rogerdavies.com/2008/08/url-rewriting-to-make-your-urls-search-engine-friendly-and-domain-forwarding/#comments</comments>
		<pubDate>Sun, 31 Aug 2008 15:41:15 +0000</pubDate>
		<dc:creator>Roger Davies</dc:creator>
				<category><![CDATA[Techno Babble]]></category>
		<category><![CDATA[301]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[blog articles]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[domain forwarding]]></category>
		<category><![CDATA[dynamic page]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[multiple domains]]></category>
		<category><![CDATA[parmanent]]></category>
		<category><![CDATA[redirected]]></category>
		<category><![CDATA[rewrite]]></category>
		<category><![CDATA[rewrite engine]]></category>
		<category><![CDATA[search engine friendly]]></category>
		<category><![CDATA[search engines]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[submit]]></category>
		<category><![CDATA[URL rewriting]]></category>
		<category><![CDATA[URLs]]></category>

		<guid isPermaLink="false">http://rogerdavies.com/blog/?p=194</guid>
		<description><![CDATA[I&#8217;ve often read SEO articles or people mention URL rewriting to make URLs search engine friendly.  But found myself questioning it&#8217;s value because search engines seem fairly smart.  I&#8217;ve noticed that the vast majority will find a pages&#8217; content (even a dynamic page) if there is some kind of link which includes the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve often read SEO articles or people mention <a href="http://httpd.apache.org/docs/2.0/misc/rewriteguide.html">URL rewriting</a> to make URLs search engine friendly.  But found myself questioning it&#8217;s value because search engines seem fairly smart.  I&#8217;ve noticed that the vast majority will find a pages&#8217; content (even a dynamic page) if there is some kind of link which includes the variables being passed.  So what have we actually bought with all this messing around?</p>
<p>If you look closely at the URLs of these blog entries, I have constructed a crude .htaccess file to allow me to rewrite from the form ./blog/entry/51 to rewrite to ./blog/index.php?p=51,(etc) (although I would need to rewrite sections of wordpress&#8217; code in order to ensure it volunteers up the tidy form of URLs when building up my blog page for the user, rather than the <em><strong>actual </strong></em>URLs!)</p>
<h2 style="color:#888888; font-size:15px;">Sure, when link building for individual blog articles we can submit a much more friendly URL.  Is this all?</h2>
<p>Well, I found out this weekend when I bought rogerdavies.com.  I want all requests from rogerdavies.eu to forward to rogerdavies.com, and &#8211; until now &#8211; I had just used some scripting code like:</p>
<table border="1" width="100%" align="center">
<tbody>
<tr>
<td>
<pre id="line1">&lt;?php
header ('HTTP/1.1 301 Moved Permanently');
header( 'Location: http://www.rogerdavies.com' ) ;
?&gt;</pre>
</td>
</tr>
</tbody>
</table>
<p>BUT, if you have multiple domains on the same account (perhaps you have recently bought an older domain that you wish to forward from or to?) you can actually use Apaches&#8217; Rewrite engine to change domains entirely!</p>
<p>Try accessing <a href="http://www.rogerdavies.eu/blog/entry/51">www.rogerdavies.eu/blog/entry/51</a></p>
<p>and you will find yourself redirected to <a href="http://www.rogerdavies.com/blog/entry/51">www.rogerdavies.com/blog/entry/51</a>! You can specify to the Apache rewrite engine the redirect is permanent by adding : <strong>[R=permanent]</strong> which will give a <strong>301</strong> to any request, making them all search engine friendly, helping be sure search engines are aware that your domain has moved, <strong>AND </strong> (as an added bonus) will try to hand the user the same document they requested, but from the new domain name.</p>
<p>This is helpful, if a blog has backlinks to articles, they will still be valid (even though my domain has now changed), and will still ensure all traffic finds it&#8217;s way to the new domain (and to the right files the user wanted)</p>
<p>This was achieved with the following rule:</p>
<table border="1" width="100%" align="center">
<tbody>
<tr>
<td>
<pre id="line1">RewriteEngine on
RewriteCond %{HTTP_HOST} ^rogerdavies.eu
RewriteRule ^(.*)$ http://www.rogerdavies.com/$1 [R=permanent]
RewriteCond %{HTTP_HOST} ^www.rogerdavies.eu
RewriteRule ^(.*)$ http://www.rogerdavies.com/$1 [R=permanent]</pre>
</td>
</tr>
</tbody>
</table>
<p>Thus, any existing links to my blog articles out there will still be valid, and generate traffic for my new domain (not just my old one), let search engines know it has moved <em><strong>AND </strong></em>ensure the user finds the article they were after (without any complex code) all in one move.</p>
<p>Try doing <em><strong>this </strong></em>with a php header() function</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.rogerdavies.com%2F2008%2F08%2Furl-rewriting-to-make-your-urls-search-engine-friendly-and-domain-forwarding%2F&amp;linkname=URL%20Rewriting%20to%20Make%20Your%20URLs%20Search%20Engine%20Friendly%20and%20Domain%20Forwarding"><img src="http://www.rogerdavies.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Save/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.rogerdavies.com/2008/08/url-rewriting-to-make-your-urls-search-engine-friendly-and-domain-forwarding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
