<?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>Onyx Design Weblog &#187; .htaccess</title>
	<atom:link href="http://www.onyx-design.net/category/htaccess/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.onyx-design.net</link>
	<description>A weblog about webdesign, webdevelopment, css, php and other webrelated topics.</description>
	<lastBuildDate>Thu, 03 Jun 2010 15:34:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Redirecting with .htaccess</title>
		<link>http://www.onyx-design.net/other/redirecting-with-htaccess/</link>
		<comments>http://www.onyx-design.net/other/redirecting-with-htaccess/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 15:12:05 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/htaccess/redirecting-with-htaccess/</guid>
		<description><![CDATA[Here&#8217;s my second tutorial about .htaccess, the first one was about making your own custom 404-error page. This one is about redirecting with .htaccess. In this tutorial I&#8217;ll explain the benefits of using .htaccess to redirect, instead of PHP or Javascript and I&#8217;ll show some examples about how to use .htaccess redirects.

Why?
There are a couple [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s my second tutorial about .htaccess, the first one was about <a href="http://www.onyx-design.net/weblog2/htaccess/how-to-make-a-custom-404-page/">making your own custom 404-error</a> page. This one is about redirecting with .htaccess. In this tutorial I&#8217;ll explain the benefits of using .htaccess to redirect, instead of <acronym title="Pre-Hypertext Processing">PHP</acronym> or Javascript and I&#8217;ll show some examples about how to use .htaccess redirects.</p>
<p><span id="more-59"></span></p>
<h3>Why?</h3>
<p>There are a couple of reasons for using .htaccess redirects instead of <acronym title="Pre-Hypertext Processing">PHP</acronym> or even Javascript. First of all, it&#8217;s very simple. There is no need to edit any files, you just need to change the .htaccess file. Imagine you need to redirect a whole directory of your site, with hundreds of pages. If you would use Javascript, you had to change every file, or at least use some search and replace commands to get the javascript on every page. With .htaccess you can easily redirect a whole directory.</p>
<p>It&#8217;s easy, but it&#8217;s also better for SEO to use .htaccess redirects. You can specify the type of your redirect, either temporarily (302) or permanent (301). You can&#8217;t do that with Javascript.</p>
<p>So now you know <em>why </em>you should use .htaccess redirects, now let&#8217;s take a look to <em>how</em> you use it.</p>
<h3>How?</h3>
<p>If you haven&#8217;t made a .htaccess file yet, make one. See the <a href="http://www.onyx-design.net/weblog2/htaccess/how-to-make-a-custom-404-page/">previous tutorial</a> for details.</p>
<p>This is the basic syntax of a .htaccess redirect:<br />
<code>Redirect /olddirectory http://www.newdomain.com/newdirectory</code></p>
<p>But if you want to redirect that directory <em>permanent, </em>don&#8217;t forget to add 301 or permanent:<br />
<code>Redirect 301 /olddirectory http://www.newdomain.com/newdirectory<br />
Redirect permanent /olddirectory http://www.newdomain.com/newdirectory</code></p>
<p><strong>Redirecting a whole site</strong><br />
You can use this code to redirect a whole site to a new domain:<br />
<code>Redirect 301 / http://www.newdomain.com/</code></p>
<h3>RedirectMatch</h3>
<p>You can use redirectmatch for some more complicated redirects. Let&#8217;s take a look at the previous example, where I used <em>Redirect 301</em> to move a whole site. I you would go to <em>http://www.olddomain.com/contact </em>you would be redirect to <em>http://www.newdomain.com/</em>. So it doesn&#8217;t matter what you incoming page is, you would always be redirected to the homepage of the new domain. If you don&#8217;t want that to happen then you can use Redirectmatch to redirect your whole site. This code will redirect a visitor (or search engine) to the same file at the new domain:</p>
<p><code>RedirectMatch 301 ^(.*)$ http://www.newdomain.com/</code></p>
<p>Did this tutorial helped you? Please leave a comment and tell how this tutorial helped you.</p>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/other/redirecting-with-htaccess/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to make a custom 404 page</title>
		<link>http://www.onyx-design.net/other/how-to-make-a-custom-404-page/</link>
		<comments>http://www.onyx-design.net/other/how-to-make-a-custom-404-page/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 15:47:42 +0000</pubDate>
		<dc:creator>Fabian</dc:creator>
				<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.onyx-design.net/weblog2/htaccess/how-to-make-a-custom-404-page/</guid>
		<description><![CDATA[You can achieve a lot of things with a .htaccess-file. You can make your own custom 404-error pages, redirect pages, rewrite pages, block IP-adresses and more. In this first .htaccess tutorial, I will explain the custom error pages.

How to make a .htaccess file
A .htaccess file is very easy to make. I always use Notepad to [...]]]></description>
			<content:encoded><![CDATA[<p>You can achieve a lot of things with a <em>.htaccess</em>-file. You can make your own custom 404-error pages, redirect pages, rewrite pages, block <acronym title="Internet Protocol">IP</acronym>-adresses and more. In this first .htaccess tutorial, I will explain the custom error pages.<br />
<span id="more-48"></span></p>
<h3>How to make a .htaccess file</h3>
<p>A .htaccess file is very easy to make. I always use Notepad to modify it. But you have to pay attention when you save the file. .htaccess is the extension of the file, <strong>not</strong> the name. The file must no be for example <em>.htaccess.txt</em> but just <em>.htaccess</em> . The .htaccess file must be uploaded to your root folder to make everything work.</p>
<h3>Custom 404-error page</h3>
<p>It is not hard to make you own custom 404-error page with .htaccess. First make a new file. This will be your error page. For example call it 404.html and place it in your root directory. There are loads of articles about &#8220;the perfect 404-page&#8221;. Some things include: adding a search box so people can search the site for what they were looking for, adding a e-mail adress to contact the webmaster, etc. There are nice articles about this on <a href="http://www.google.com/url?sa=t&amp;ct=res&amp;cd=3&amp;url=http%3A%2F%2Fwww.alistapart.com%2Farticles%2Fperfect404&amp;ei=q6C5R5DkPJ30wwGy2czgCg&amp;usg=AFQjCNGRYKpSf2wDoxo0ueuSn60yChnWiQ&amp;sig2=TN8NEk-Fc0wT6oGdmAkyzw" rel="nofollow" >A List Apart</a> and <a href="http://www.codinghorror.com/blog/archives/000819.html" rel="nofollow" >Coding Horror</a>. This is what you have to place in your .htaccess file in our example:</p>
<p><code>ErrorDocument 404 /404.html</code></p>
<p>This is only the 404 error, but there are loads of errors that you can make custom pages for. A list:</p>
<ul>
<li>302 &#8211; Redirect</li>
<li>400 &#8211; Bad Request</li>
<li>401 &#8211; Authorization Required</li>
<li>402 &#8211; Payment Required</li>
<li>403 &#8211; Forbidden</li>
<li>404 &#8211; File Not Found</li>
<li>405 &#8211; Method Not Allowed</li>
<li>406 &#8211; Not Acceptable</li>
<li>407 &#8211; Proxy Authentication Required</li>
<li>408 &#8211; Request Time-out</li>
<li>409 &#8211; Conflict</li>
<li>410 &#8211; Gone</li>
<li>411 &#8211; Length Required</li>
<li>412 &#8211; Precondition Failed</li>
<li>413 &#8211; Request Entity Too Large</li>
<li>414 &#8211; Request-<acronym title="Uniform Resource Identifier">URI</acronym> Too Large</li>
<li>415 &#8211; Unsupported Media Type</li>
<li>500 &#8211; Internal Server Error</li>
<li>501 &#8211; Method Not Implemented</li>
<li>502 &#8211; Bad Gateway</li>
<li>503 &#8211; Service Temporarily Unavailable</li>
<li>504 &#8211; Gateway Time-out</li>
<li>505 &#8211; <acronym title="HyperText Transfer Protocol">HTTP</acronym> Version Not Supported</li>
</ul>
<p>I&#8217;ll write more .htaccess tutorials soon.</p>]]></content:encoded>
			<wfw:commentRss>http://www.onyx-design.net/other/how-to-make-a-custom-404-page/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
