<?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: How do I redirect subfolder URLs to subdomain URLs?</title>
	<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs/</link>
	<description>Comments on Ask MetaFilter post How do I redirect subfolder URLs to subdomain URLs?</description>
	<pubDate>Wed, 18 Mar 2009 11:42:32 -0800</pubDate>
	<lastBuildDate>Wed, 18 Mar 2009 11:42:32 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How do I redirect subfolder URLs to subdomain URLs?</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs</link>	
		<description>Apologies for asking a question that I know will be answered already on the web, somewhere, but I can&apos;t find it. I&apos;m having trouble writing a .htaccess ReWrite rule that will forward requests for all folders within a specific sub-folder to the same folders at a subdomain - so http://www.mydomain.com/hello/foo/bar/ will forward to http://hello.mydomain.com/foo/bar/

Any advice very gratefully received.</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2009:site.117076</guid>
		<pubDate>Wed, 18 Mar 2009 11:37:58 -0800</pubDate>
		<dc:creator>Cobbler</dc:creator>
		
			<category>htaccess</category>
		
			<category>redirect</category>
		
			<category>rewrite</category>
		
	</item> <item>
		<title>By: mkb</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678315</link>	
		<description>It would help greatly if you could post what you have for a rule now.&lt;br&gt;
&lt;br&gt;
Also, this might be something worth asking at &lt;a href=&quot;http://stackoverflow.com&quot;&gt;Stack Overflow&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;
My thought is that this rule should do it if placed in .htaccess in [www.mydomain.com DocumentRoot]/hello:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;RewriteRule $1 http://hello.mydomain.com/$1 [R,QSA]&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678315</guid>
		<pubDate>Wed, 18 Mar 2009 11:42:32 -0800</pubDate>
		<dc:creator>mkb</dc:creator>
	</item><item>
		<title>By: Cobbler</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678323</link>	
		<description>At the moment all I have is the very basic main folder rule working:&lt;br&gt;
&lt;br&gt;
RewriteRule ^hello http://hello.mydomain.com [R=301,L]</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678323</guid>
		<pubDate>Wed, 18 Mar 2009 11:50:58 -0800</pubDate>
		<dc:creator>Cobbler</dc:creator>
	</item><item>
		<title>By: mkb</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678342</link>	
		<description>Oof, that rule I wrote down won&apos;t work; it doesn&apos;t even make sense. Your problem is that everything will redirect to the root of hello.mydomain.com, which you don&apos;t want.&lt;br&gt;
&lt;br&gt;
Try:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;RewriteRule ^hello/(.*)$ http://hello.mydomain.com/$1 [R=3-1,L,QSA]&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678342</guid>
		<pubDate>Wed, 18 Mar 2009 12:00:28 -0800</pubDate>
		<dc:creator>mkb</dc:creator>
	</item><item>
		<title>By: Cobbler</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678535</link>	
		<description>It looks like it should work, but gives me 500 errors, I&apos;m afraid - that&apos;s both with my original lines in place and with them removed.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678535</guid>
		<pubDate>Wed, 18 Mar 2009 13:42:55 -0800</pubDate>
		<dc:creator>Cobbler</dc:creator>
	</item><item>
		<title>By: mkb</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678553</link>	
		<description>Geez, you will have to excuse my horrible typing. That &apos;3-1&apos; should be &apos;301&apos;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678553</guid>
		<pubDate>Wed, 18 Mar 2009 13:56:26 -0800</pubDate>
		<dc:creator>mkb</dc:creator>
	</item><item>
		<title>By: Cobbler</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678569</link>	
		<description>Heh. I&apos;d already spotted that and fixed it. Sorry.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678569</guid>
		<pubDate>Wed, 18 Mar 2009 14:07:24 -0800</pubDate>
		<dc:creator>Cobbler</dc:creator>
	</item><item>
		<title>By: niles</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678570</link>	
		<description>Maybe the &quot;301&quot; gets this working for you, but if not, I&apos;ve been using the following .htaccess for years to redirect from subdomain1.example.com to subdomain2.example.com for years. The file lives in the root of the subdomain1, which for you would be www.&lt;br&gt;
&lt;br&gt;
&lt;code&gt;Options +FollowSymLinks&lt;br&gt;
RewriteEngine on&lt;br&gt;
RewriteCond %{HTTP_HOST} ^subdomain1.example.com$&lt;br&gt;
RewriteRule ^(.*)$ http://subdomain2.example.com/$1 [R=permanent,L]&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
Basically I shoot people to the (shorter) subdomain1 address, and no matter what they type it automagically turns into subdomain2.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678570</guid>
		<pubDate>Wed, 18 Mar 2009 14:08:31 -0800</pubDate>
		<dc:creator>niles</dc:creator>
	</item><item>
		<title>By: Cobbler</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678581</link>	
		<description>&lt;em&gt;&quot;no matter what they type it automagically turns into subdomain2&quot;&lt;/em&gt;&lt;br&gt;
&lt;br&gt;
Thanks, but I don&apos;t think that&apos;s what I actually want - it&apos;s only people who visit the specific /hello/ folder and deeper that should be redirected.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678581</guid>
		<pubDate>Wed, 18 Mar 2009 14:14:11 -0800</pubDate>
		<dc:creator>Cobbler</dc:creator>
	</item><item>
		<title>By: Cobbler</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678653</link>	
		<description>mkb: My mistake, your suggestion does work, but now requests for the folder without a trailing slash bring up 404s.&lt;br&gt;
&lt;br&gt;
i.e. while http://www.mydomain.com/hello/ forwards OK, http://www.mydomain.com/hello doesn&apos;t.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678653</guid>
		<pubDate>Wed, 18 Mar 2009 15:10:46 -0800</pubDate>
		<dc:creator>Cobbler</dc:creator>
	</item><item>
		<title>By: sbutler</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678659</link>	
		<description>&lt;i&gt;It looks like it should work, but gives me 500 errors, I&apos;m afraid - that&apos;s both with my original lines in place and with them removed.&lt;/i&gt;&lt;br&gt;
&lt;br&gt;
Wait... you mean even without Rewrite rules you&apos;re getting a 500 error? Can&apos;t help you there. Something&apos;s drastically wrong with your setup.&lt;br&gt;
&lt;br&gt;
If you are only getting 500 errors when you add any rewrite rule, the make sure that FollowSymLinks is set for that directory.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678659</guid>
		<pubDate>Wed, 18 Mar 2009 15:20:35 -0800</pubDate>
		<dc:creator>sbutler</dc:creator>
	</item><item>
		<title>By: Cobbler</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678671</link>	
		<description>No, I&apos;m not getting the errors now - see the post above yours.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678671</guid>
		<pubDate>Wed, 18 Mar 2009 15:25:57 -0800</pubDate>
		<dc:creator>Cobbler</dc:creator>
	</item><item>
		<title>By: Cobbler</title>
		<link>http://ask.metafilter.com/117076/How-do-I-redirect-subfolder-URLs-to-subdomain-URLs#1678684</link>	
		<description>Thanks everyone for your help - I got all the various URLs working with two lines: &lt;br&gt;
&lt;br&gt;
&lt;code&gt;RewriteRule ^hello(.*)$ http://hello.mydomain.com [R=301,L] &lt;br&gt;
RewriteRule ^hello/(.*)$ http://hello.mydomain.com/$1 [R=301,L]&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2009:site.117076-1678684</guid>
		<pubDate>Wed, 18 Mar 2009 15:37:48 -0800</pubDate>
		<dc:creator>Cobbler</dc:creator>
	</item>
	</channel>
</rss>
