<?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>Zero Mu Tech Articles &#187; redirectmatch</title>
	<atom:link href="http://www.techarticles.zeromu.net/tag/redirectmatch/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.techarticles.zeromu.net</link>
	<description>Solutions to computer problems that were in my way.</description>
	<lastBuildDate>Sun, 09 May 2010 03:48:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using RedirectMatch in .htaccess to redirect entire web site</title>
		<link>http://www.techarticles.zeromu.net/programming/apache/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/</link>
		<comments>http://www.techarticles.zeromu.net/programming/apache/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 05:50:17 +0000</pubDate>
		<dc:creator>Jake D</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[redirectmatch]]></category>

		<guid isPermaLink="false">http://www.techarticles.zeromu.net/2008/03/05/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/</guid>
		<description><![CDATA[When changing websites, I was trying to use Apache&#8217;s RedirectMatch to send all documents from one domain to another domain. I used code that I found on other websites, but I found that it didn&#8217;t do what I wanted. What I wanted was for a user to put in http://www.olddomain.com/a_file.html and be redirected to http://newdomain.com/a_file.html.<br/><br/><a href="http://www.techarticles.zeromu.net/programming/apache/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/">Read more...</a>]]></description>
			<content:encoded><![CDATA[<p>When changing websites, I was trying to use Apache&#8217;s <code>RedirectMatch</code> to send all documents from one domain to another domain.  I used code that I found on other websites, but I found that it didn&#8217;t do what I wanted.</p>
<p>What I wanted was for a user to put in <code>http://www.olddomain.com/a_file.html</code> and be redirected to <code>http://newdomain.com/a_file.html</code>.  I wanted it to do that for each file, and I didn&#8217;t want to specify a redirect for each file.  I didn&#8217;t want to use <code>mod_rewrite</code> because I wanted to give the 301 redirect for Search Engine Optimization (SEO) reasons.</p>
<p><strong>Quick Answer</strong>: use  <code>RedirectMatch permanent ^(.*)$ http://www.newdomain.com$1</code> in a <code>.htaccess</code> file in your old domain.</p>
<p>Initially, I read that this line</p>
<p><code>RedirectMatch permanent ^(.*)$ http://www.newdomain.com</code></p>
<p>would redirect all files from the old domain to files on the new domain of the same name when placed in the <code>.htaccess</code> file in the <code>/www/</code> directory of the old domain.  However, when I tried this, all of my redirects simply redirected to the index file of the new domain.  For example,</p>
<p><code>http://www.olddomain.com/file_a.html</p>
<p>http://www.olddomain.com/file_b.html</code></p>
<p>would both redirect to</p>
<p><code>http://www.newdomain.com/index.html</code></p>
<p>Then I modified the apache directive to</p>
<p><code>RedirectMatch permanent ^(.*)$ http://www.newdomain.com$1</code></p>
<p>and this worked for me.  Even when I put in a bad filename, I got my new domain&#8217;s 404 error document.</p>
<p>Not sure why I found <code>RedirectMatch permanent ^(.*)$ http://www.newdomain.com</code> in several sources and it didn&#8217;t work&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.techarticles.zeromu.net/programming/apache/using-redirectmatch-in-htaccess-to-redirect-entire-web-site/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
