[ic] Redirecting Based on Domain

Michael Stearne interchange-users@interchange.redhat.com
Wed Jan 2 15:16:01 2002


Answers like this are exactly what I think about when I talk to someone 
from Sun or MS about the issue of "no support" for OpenSource software.

Thanks!
Michael


Yury German wrote:

>I have a few things set up on my server so it is easy for me to tell you how to do redirects.
>
>The redericts need to go in to the 
>Vhosts.conf file which is located where you have your configs setup.
>
>You need to have the following line first
>
>NameVirtualHost * 
>
>(This sets up the virtual hosting for your system)
>
>Then setup the main server pages I will use domain - www.myserver.com
>The server is located in /var/www/myserver
>
>
><VirtualHost *>
>Server Name www.myserver.com
>ServerAdmin yourname@yourmailaddress.com
>ServerAlias myserver.myserver.com
>#Server Aliases can be anything you want to redirect to that location
>ScriptAlias /cgi-bin /var/www/myserver/cgi-bin/
>Document Root /var/www/myserver
></VirtualHost>	
>
>Now if you want to rewrite everything for the host shop.myserver.com Which is located in the directory SHOP
>You would do the following.
>
><VirtualHost * >
>ServerName shop.myserver.com
>ServerAlias ic.myserver.com anythingelse.myserver.com
>ServerAdmin myname@yourmailaddress.com
>ScriptAlias /cgi-bin /var/www/myserver/cgi-bin/
>DocumentRoot /var/www/myserver/
>        RewriteEngine On
>        RewriteRule ^/(.*) http://www.myserver.com/shop/ [p]
>        RewriteLog "/var/log/httpd/rewrite.log"
></VirtualHost>
>
>This should work just fine for the rewrites (at least it does on my servers)
>
>-----Original Message-----
>From: interchange-users-admin@interchange.redhat.com
>
>>There isn't an Interchange way to do it, because the request doesn't even
>>hit Interchange until after the redirect happens, so it must be done in the
>>web server.
>>
>That's true sine I gave the example of am.mydomain.com points to 
>www.mydomain.com/fea/.... where it wouldn't hit Interchange at the main 
>request.  I will probably be looking into mod_rewrite again.  
>
>One question though, while using Perl (or ITL) code in ITL can I get the 
>server name (HTTP_HOST) or any of the other environment variables?
>
>Thanks,
>Michael
>
>_______________________________________________
>interchange-users mailing list
>interchange-users@interchange.redhat.com
>http://interchange.redhat.com/mailman/listinfo/interchange-users
>
>