<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Redirecting subdomains to directories in apache.</title>
	<atom:link href="http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/</link>
	<description>the personal blog of Stuart Colville covering modern web development techniques and best practices</description>
	<lastBuildDate>Mon, 21 May 2012 05:48:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: John M</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-66480</link>
		<dc:creator>John M</dc:creator>
		<pubDate>Sat, 19 Feb 2011 00:46:56 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-66480</guid>
		<description>I took the instructions as above exactly but my site (hosted on Media temple) keeps the subdomain and tries to direct the user to a &quot;/home&quot; directory?

For example:

http://subdomain.primary.com

should redirect to:
 http://primary.com/subdomain

but it instead goes to:
http://subdomain.primary.com/home


anybody else having this issue?</description>
		<content:encoded><![CDATA[<p>I took the instructions as above exactly but my site (hosted on Media temple) keeps the subdomain and tries to direct the user to a &#8220;/home&#8221; directory?</p>
<p>For example:</p>
<p><a href="http://subdomain.primary.com" rel="nofollow">http://subdomain.primary.com</a></p>
<p>should redirect to:<br />
 <a href="http://primary.com/subdomain" rel="nofollow">http://primary.com/subdomain</a></p>
<p>but it instead goes to:<br />
<a href="http://subdomain.primary.com/home" rel="nofollow">http://subdomain.primary.com/home</a></p>
<p>anybody else having this issue?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-65723</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Thu, 09 Sep 2010 21:14:42 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-65723</guid>
		<description>Hi,
I am trying to figure out how to achieve a relitivly simple task (if i were using cPanel) But unfortunitly I have to use Plesk with my webhosting provider :(

A URL Redirect / Forward...

Okay..

Atm, both URL&#039;s will be successful:
&lt;code&gt; http://www.domain.com&lt;/code&gt; and &lt;code&gt;http://domain.com&lt;/code&gt; end up resolving to the index.htm


I just need the above to forward to:
&lt;code&gt;http://www.domain.com/shop/&lt;/code&gt;
to be the default landing page for my website.

I know this can be achieved by a META-REFRESH but I prefer to begin to make a stable working .htaccess file and/or vhost.conf file for later additions to the websites architecture.  

This is what I have already:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.* [NC]
RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com
RewriteCond /var/www/vhosts/domain.com/httpdocs/shop/%1 -d
RewriteRule ^(.*) /%1/$1 [L]



Many Thanks in Advance.

I am completely stuck...

The following site is using Plesk on a vhost shared server. It runs on Apache 2.2 Mod_Rewrite enabled.

Any help much appretiated.</description>
		<content:encoded><![CDATA[<p>Hi,<br />
I am trying to figure out how to achieve a relitivly simple task (if i were using cPanel) But unfortunitly I have to use Plesk with my webhosting provider <img src='http://muffinresearch.co.uk/wordpress/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>A URL Redirect / Forward&#8230;</p>
<p>Okay..</p>
<p>Atm, both URL&#8217;s will be successful:<br />
<code> <a href="http://www.domain.com" rel="nofollow">http://www.domain.com</a></code> and <code><a href="http://domain.com" rel="nofollow">http://domain.com</a></code> end up resolving to the index.htm</p>
<p>I just need the above to forward to:<br />
<code><a href="http://www.domain.com/shop/" rel="nofollow">http://www.domain.com/shop/</a></code><br />
to be the default landing page for my website.</p>
<p>I know this can be achieved by a META-REFRESH but I prefer to begin to make a stable working .htaccess file and/or vhost.conf file for later additions to the websites architecture.  </p>
<p>This is what I have already:</p>
<p>RewriteEngine on<br />
RewriteCond %{HTTP_HOST} ^www.* [NC]<br />
RewriteCond %{HTTP_HOST} !^www.* [NC]<br />
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com<br />
RewriteCond /var/www/vhosts/domain.com/httpdocs/shop/%1 -d<br />
RewriteRule ^(.*) /%1/$1 [L]</p>
<p>Many Thanks in Advance.</p>
<p>I am completely stuck&#8230;</p>
<p>The following site is using Plesk on a vhost shared server. It runs on Apache 2.2 Mod_Rewrite enabled.</p>
<p>Any help much appretiated.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-65716</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Fri, 03 Sep 2010 20:53:19 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-65716</guid>
		<description>I was able to use this to redirect too but like Bruno webmail for that domain is not working anymore.
Any suggestion?</description>
		<content:encoded><![CDATA[<p>I was able to use this to redirect too but like Bruno webmail for that domain is not working anymore.<br />
Any suggestion?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-65675</link>
		<dc:creator>David</dc:creator>
		<pubDate>Thu, 08 Jul 2010 14:54:40 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-65675</guid>
		<description>Hello,

I am trying to display a 404 if the subdirectory does not exist. Any ideas how to modify the following code to do this?

&lt;code&gt;
ServerAlias *.example.com
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com RewriteCond /var/www/html/subdir/%1 -d RewriteRule ^(.*) /%1/$1 [L] 

&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Hello,</p>
<p>I am trying to display a 404 if the subdirectory does not exist. Any ideas how to modify the following code to do this?</p>
<p><code><br />
ServerAlias *.example.com<br />
RewriteEngine on<br />
RewriteCond %{HTTP_HOST} !^www.* [NC]<br />
RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com RewriteCond /var/www/html/subdir/%1 -d RewriteRule ^(.*) /%1/$1 [L] </p>
<p></code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Klein</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-65512</link>
		<dc:creator>Adam Klein</dc:creator>
		<pubDate>Wed, 03 Feb 2010 08:05:08 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-65512</guid>
		<description>Glad to find this post.

I&#039;d like to redirect advisors.pacificadvisors.com to http://thedock.pacificadvisors.com/advisors/training-education-schedule 
using vhost.conf as I tried .htaccess and that didn&#039;t work.  Currently vhost.conf file has:
 
serverAlias *.domain.com
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com
RewriteCond /var/www/vhosts/domain.com/httpdocs/%1 -d

would appreciate some help
RewriteRule ^(.*) /%1/$1 [L]</description>
		<content:encoded><![CDATA[<p>Glad to find this post.</p>
<p>I&#8217;d like to redirect advisors.pacificadvisors.com to <a href="http://thedock.pacificadvisors.com/advisors/training-education-schedule" rel="nofollow">http://thedock.pacificadvisors.com/advisors/training-education-schedule</a><br />
using vhost.conf as I tried .htaccess and that didn&#8217;t work.  Currently vhost.conf file has:</p>
<p>serverAlias *.domain.com<br />
RewriteEngine on<br />
RewriteCond %{HTTP_HOST} !^www.* [NC]<br />
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com<br />
RewriteCond /var/www/vhosts/domain.com/httpdocs/%1 -d</p>
<p>would appreciate some help<br />
RewriteRule ^(.*) /%1/$1 [L]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: emre</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-65509</link>
		<dc:creator>emre</dc:creator>
		<pubDate>Sat, 30 Jan 2010 07:51:38 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-65509</guid>
		<description>hey there,

i am looking for a way to internally redirect http://xxx.domain.com/yyy requests to file.php?item1=$xxx&amp;item2=yyy on apache. 

namely i need a subdomain and an ordinary redirect at the same time.

i can do http://xxx.domain.com &gt; somefile.php?item=xxx and http://www.domain.com/yyy redirects seperately. now i need to combine them.

i tried this:
&lt;code&gt;RewriteCond %{HTTP_HOST} !^www\.ceviritercume\.org$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.ceviritercume\.org/([A-Za-z0-9_)(:!-&#039;,]+)/?$ [NC]
RewriteRule ^$ /dil_konu.php?dil=%2&amp;konu=$1 [L] &lt;/code&gt;

but no success...

any ideas how it can be achieved?</description>
		<content:encoded><![CDATA[<p>hey there,</p>
<p>i am looking for a way to internally redirect <a href="http://xxx.domain.com/yyy" rel="nofollow">http://xxx.domain.com/yyy</a> requests to file.php?item1=$xxx&amp;item2=yyy on apache. </p>
<p>namely i need a subdomain and an ordinary redirect at the same time.</p>
<p>i can do <a href="http://xxx.domain.com" rel="nofollow">http://xxx.domain.com</a> &gt; somefile.php?item=xxx and <a href="http://www.domain.com/yyy" rel="nofollow">http://www.domain.com/yyy</a> redirects seperately. now i need to combine them.</p>
<p>i tried this:<br />
<code>RewriteCond %{HTTP_HOST} !^www\.ceviritercume\.org$ [NC]<br />
RewriteCond %{HTTP_HOST} ^(www\.)?([^\.]+)\.ceviritercume\.org/([A-Za-z0-9_)(:!-',]+)/?$ [NC]<br />
RewriteRule ^$ /dil_konu.php?dil=%2&amp;konu=$1 [L] </code></p>
<p>but no success&#8230;</p>
<p>any ideas how it can be achieved?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruno</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-65444</link>
		<dc:creator>Bruno</dc:creator>
		<pubDate>Thu, 03 Dec 2009 10:45:01 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-65444</guid>
		<description>Hello...
perhaps i didnt explain the way it should :)
i want that webmail.ingrupo.com goes to webmail ( HORDE ) the default server webmail reader and not a directory inside ingrupo.com.
if i remove that line it will search for that dir inside ingrupo.com/sites right? but i want that when users type webmail.ingrupo.com they can access the email software from that server.

Regards,
B</description>
		<content:encoded><![CDATA[<p>Hello&#8230;<br />
perhaps i didnt explain the way it should <img src='http://muffinresearch.co.uk/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
i want that webmail.ingrupo.com goes to webmail ( HORDE ) the default server webmail reader and not a directory inside ingrupo.com.<br />
if i remove that line it will search for that dir inside ingrupo.com/sites right? but i want that when users type webmail.ingrupo.com they can access the email software from that server.</p>
<p>Regards,<br />
B</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Colville</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-65443</link>
		<dc:creator>Stuart Colville</dc:creator>
		<pubDate>Thu, 03 Dec 2009 09:37:40 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-65443</guid>
		<description>@Bruno: The second RewriteCond directive is saying ensure the host &lt;em&gt;does not&lt;/em&gt; start with webmail.

As a result any requests to webmail.ingrupo.com will not be processed by the rest of the re-write rule.</description>
		<content:encoded><![CDATA[<p>@Bruno: The second RewriteCond directive is saying ensure the host <em>does not</em> start with webmail.</p>
<p>As a result any requests to webmail.ingrupo.com will not be processed by the rest of the re-write rule.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bruno</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-65441</link>
		<dc:creator>Bruno</dc:creator>
		<pubDate>Wed, 02 Dec 2009 19:01:22 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-65441</guid>
		<description>hello..
i&#039;ve tried 

&lt;pre&gt;&lt;code&gt;ServerAlias *.ingrupo.com
RewriteEngine on

RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} !^webmail.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.ingrupo\.com
RewriteCond /var/www/vhosts/ingrupo.com/httpdocs/sites/%1 -d
RewriteRule ^(.*) /sites/%1/$1 [L]&lt;/code&gt;&lt;/pre&gt;


and it redirects ok.. but webmail doesnt work.. it redirects to ingrupo.com and not for the real webmail.ingrupo.com
any ideas?!

Regards,
B</description>
		<content:encoded><![CDATA[<p>hello..<br />
i&#8217;ve tried </p>
<pre><code>ServerAlias *.ingrupo.com
RewriteEngine on

RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} !^webmail.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.ingrupo\.com
RewriteCond /var/www/vhosts/ingrupo.com/httpdocs/sites/%1 -d
RewriteRule ^(.*) /sites/%1/$1 [L]</code></pre>
<p>and it redirects ok.. but webmail doesnt work.. it redirects to ingrupo.com and not for the real webmail.ingrupo.com<br />
any ideas?!</p>
<p>Regards,<br />
B</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vijay</title>
		<link>http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/comment-page-1/#comment-65397</link>
		<dc:creator>vijay</dc:creator>
		<pubDate>Mon, 09 Nov 2009 06:42:22 +0000</pubDate>
		<guid isPermaLink="false">http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/#comment-65397</guid>
		<description>I have One issue, please help me. My issue is I have url http://subdomain.mydomain.com and want to redirect them http://mydomin.com/folder1/index.php?user=subdomain. but I dont want to change URL in addressbar so in addressbar the url should be http://subdomain.mydomain.com. What i have to do? My .htaccess code is:

&lt;pre&gt;&lt;code&gt;=================================
#RewriteCond %{HTTP_HOST} !^www\.mydomain.com [NC]
#RewriteCond %{HTTP_HOST} ([^.]+)\.mydomain.com [NC]
#RewriteRule ^(.*)$ http://mydomain.com/folder1/index.php?user=%1 [L]
=================================&lt;/code&gt;&lt;/pre&gt;

It redirect correctly, But Unfortunitly, it affect addressbar, so it&#039;s useless for me. Please help me. What I have to do? Thanks in advance.</description>
		<content:encoded><![CDATA[<p>I have One issue, please help me. My issue is I have url <a href="http://subdomain.mydomain.com" rel="nofollow">http://subdomain.mydomain.com</a> and want to redirect them <a href="http://mydomin.com/folder1/index.php?user=subdomain" rel="nofollow">http://mydomin.com/folder1/index.php?user=subdomain</a>. but I dont want to change URL in addressbar so in addressbar the url should be <a href="http://subdomain.mydomain.com" rel="nofollow">http://subdomain.mydomain.com</a>. What i have to do? My .htaccess code is:</p>
<pre><code>=================================
#RewriteCond %{HTTP_HOST} !^www\.mydomain.com [NC]
#RewriteCond %{HTTP_HOST} ([^.]+)\.mydomain.com [NC]
#RewriteRule ^(.*)$ <a href="http://mydomain.com/folder1/index.php?user=%1" rel="nofollow">http://mydomain.com/folder1/index.php?user=%1</a> [L]
=================================</code></pre>
<p>It redirect correctly, But Unfortunitly, it affect addressbar, so it&#8217;s useless for me. Please help me. What I have to do? Thanks in advance.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

