[ic] Redirecting Based on Domain

Jonathan Melhuish interchange-users@interchange.redhat.com
Wed Jan 2 12:14:00 2002


On Wednesday 02 January 2002 11:45, you wrote:
> I have to do some redirecting of the user based on which URL they use to
> some into my site with based on subdomain name.  For example:
>
> http://am.mydomain.com/
>
> should be replaced with
>
> http://www.mydomain.com/fea/index.html?linecode=AM

Assuming you are running Apache, you could do this with a Rewrite rule in 
your httpd.conf.  This would have the advantage of being instantly applicable 
to any subdomain, which could be significantly easier than putting different 
re-direct pages on the server for each subdomain (and setting up virtual 
hosts for each).

The only down side is that mod_rewrite, whilst extremely powerful, is very 
complicated (bit like Interchange, really), to the extent that understanding 
it requires a fair bit of effort.  So my advice is either to read the 
following links and to try and learn it, or, much easier, find somebody kind 
who understands it already!

http://httpd.apache.org/docs/mod/mod_rewrite.html
http://httpd.apache.org/docs/misc/rewriteguide.html

Jon