Forum Moderators: phranque

Message Too Old, No Replies

Apache subdomain redirection

How?

         

jonatan_o2

11:19 am on Mar 21, 2005 (gmt 0)



I need to setup a redirection in httpd.conf, so that i type in, like mail.domain.com, i get redirected to, in this case, another domain. I suppose this has to do with virtual hosts, and that's what i've been playing around with. My current setup look like follows..;

nameVirtualHost mail.domain.nu:80

<VirtualHost mail.domain.nu:80>
ServerName mail.domain.nu
redirect Permanent / [[IP]:8080...]
</VirtualHost>

, though this obviously doesn't work..

Anyone?

sitz

2:33 am on Mar 25, 2005 (gmt 0)

10+ Year Member



Heh. This is one of those cases where you what you have *should* work, but there's not an easy way to debug it directly. I'd try debugging it with mod_rewrite; replace the Redirect directive with:

RewriteEngine on
RewriteLog /path/to/rewrite.log
RewriteLogLevel 9
Rewrite ^/$ http://192.168.1.1/ [L,R=301]

...then restart Apache, make your request, and see what's in the log. Once you get it debugged there, you can either keep the rule, or use what you've learned and apply it back to the Redirect directive (my personal preference; using mod_rewrite for this in production is a bit like swatting a fly with a Buick; it gets the job done, but it's overkill). Let us know what you find out.