<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: URL rewrite in IIS7: make foo.com/bah/ redirect to example.com/foo/bah/</title>
	<link>http://ask.metafilter.com/113872/URL-rewrite-in-IIS7-make-foocombah-redirect-to-examplecomfoobah/</link>
	<description>Comments on Ask MetaFilter post URL rewrite in IIS7: make foo.com/bah/ redirect to example.com/foo/bah/</description>
	<pubDate>Tue, 10 Feb 2009 12:47:52 -0800</pubDate>
	<lastBuildDate>Tue, 10 Feb 2009 12:47:52 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: URL rewrite in IIS7: make foo.com/bah/ redirect to example.com/foo/bah/</title>
		<link>http://ask.metafilter.com/113872/URL-rewrite-in-IIS7-make-foocombah-redirect-to-examplecomfoobah</link>	
		<description>Help me with a URL rewrite in IIS7 &lt;br /&gt;&lt;br /&gt; I want to implement a rewrite in IIS that would allow the following without having to create a new rule for each one.&lt;br&gt;
&lt;br&gt;
www.foo.com/books/ redirects to www.example.com/foo/books/&lt;br&gt;
www.foo.com/films/ redirects to www.example.com/foo/films/&lt;br&gt;
www.foo.com/etc/ redirects to  www.example.com/foo/etc/&lt;br&gt;
www.foo.com/etc/etc/ redirects to  www.example.com/foo/etc/etc/&lt;br&gt;
&lt;br&gt;
I am familiar with the steps in &lt;a href=&quot;http://learn.iis.net/page.aspx/460/using-url-rewrite-module/&quot;&gt;using url rewrite module in IIS7&lt;/a&gt; if that makes passing on instructions a bit easier.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2009:site.113872</guid>
		<pubDate>Tue, 10 Feb 2009 12:10:29 -0800</pubDate>
		<dc:creator>furtive</dc:creator>
		
			<category>IIS</category>
		
			<category>IIS7</category>
		
			<category>URL</category>
		
			<category>rewrite</category>
		
			<category>redirect</category>
		
			<category>regexp</category>
		
			<category>module</category>
		
	</item> <item>
		<title>By: Blazecock Pileon</title>
		<link>http://ask.metafilter.com/113872/URL-rewrite-in-IIS7-make-foocombah-redirect-to-examplecomfoobah#1635657</link>	
		<description>Try importing this into IIS with the URL Rewrite module:&lt;br&gt;
&lt;br&gt;
&lt;code&gt; RewriteCond   %{HTTP_HOST}   ^www.foo.com$   [NC]&lt;br&gt;
RewriteRule   ^(.*)$   http://www.example.com/$1   [R=301,L]&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.113872-1635657</guid>
		<pubDate>Tue, 10 Feb 2009 12:47:52 -0800</pubDate>
		<dc:creator>Blazecock Pileon</dc:creator>
	</item><item>
		<title>By: Brak</title>
		<link>http://ask.metafilter.com/113872/URL-rewrite-in-IIS7-make-foocombah-redirect-to-examplecomfoobah#1635678</link>	
		<description>I&apos;m not familiar with the rewrite module in IIS 7, but if BP&apos;s solution doesn&apos;t work, you could accomplish this (at least in IIS 6) by setting the custom error page for 404 errors for the original IIS site to something like &apos;/NewSiteRedirect.asp&apos;, and then create that NewSiteRedirect.asp page at the root of the original site, with the following content:&lt;br&gt;
&lt;br&gt;
&amp;lt;%@ Language=VBScript %&amp;gt;&lt;br&gt;
&amp;lt;%  &lt;br&gt;
Option Explicit&lt;br&gt;
&lt;br&gt;
Const NewServerName = &quot;newservername.com&quot;&lt;br&gt;
&lt;br&gt;
Dim queryStringArray, strOriginalUrl, objRegExp, strNewUrl&lt;br&gt;
&lt;br&gt;
&apos; QueryString is going to come in as 404;&amp;lt;old URL value&amp;gt;.&lt;br&gt;
queryStringArray = Split(Request.QueryString, &quot;;&quot;)&lt;br&gt;
strOriginalUrl = queryStringArray(1)&lt;br&gt;
&lt;br&gt;
Set objRegExp = new RegExp&lt;br&gt;
objRegExp.Pattern = &quot;^http://[^/]+(/.*)$&quot;&lt;br&gt;
strNewUrl = objRegExp.Replace(strOriginalUrl, &quot;http://&quot; &amp;amp; NewServerName &amp;amp; &quot;$1&quot;)&lt;br&gt;
&lt;br&gt;
Response.Redirect strNewUrl&lt;br&gt;
%&amp;gt;&lt;br&gt;
&lt;br&gt;
Anyway, that&apos;s kind of a long way around, and there are probably better approaches.  But that should work, if nothing else does.  Good luck!</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.113872-1635678</guid>
		<pubDate>Tue, 10 Feb 2009 13:14:40 -0800</pubDate>
		<dc:creator>Brak</dc:creator>
	</item><item>
		<title>By: furtive</title>
		<link>http://ask.metafilter.com/113872/URL-rewrite-in-IIS7-make-foocombah-redirect-to-examplecomfoobah#1812307</link>	
		<description>In the end I used the information available here: &lt;a href=&quot;http://learn.iis.net/page.aspx/461/creating-rewrite-rules-for-the-url-rewrite-module/&quot;&gt;Creating rewrite rules for the URL Rewrite Module&lt;/a&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.113872-1812307</guid>
		<pubDate>Tue, 07 Jul 2009 22:28:06 -0800</pubDate>
		<dc:creator>furtive</dc:creator>
	</item>
	</channel>
</rss>
