Forum

Redirect using UrlToolkit

Walter Gross
21 April 2015, 11:06
I'm trying to redirect www.test.com to www.test.bla.com using UrlToolkit (I guess that's the right way to do it in hiawatha).
In apache2, the whole think looks like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.test\.bla\.com$
RewriteRule ^(.*) http://www.test.bla.com$1 [R]


I've read through https://www.hiawatha-webserver.org/forum/topic/626 but it doesn't work here:

VirtualHost {
RequiredBinding = blacom
Hostname = www.test.com
UseToolkit = redirect
ReverseProxy .* http://blacom/ 30
WebsiteRoot = /var/www/hiawatha
AccessLogfile = /var/log/hiawatha/blacom/access.log
ErrorLogfile = /var/log/hiawatha/blacom/error.log
}

VirtualHost {
RequiredBinding = blacom
Hostname www.test.bla.com
ReverseProxy .* http://blacom/ 30
WebsiteRoot = /var/www/hiawatha
AccessLogfile = /var/log/hiawatha/blacom/access.log
ErrorLogfile = /var/log/hiawatha/blacom/error.log
}

....

UrlToolkit {
ToolkitID = redirect
Match ^/(.*) Redirect http://www.test.bla.com/$1
}



Am I doing something wrong?
Hugo Leisink
21 April 2015, 23:15
Instead of redirecting, try this:
VirtualHost {
Hostname = www.test.bla.com, www.test.com
EnforceFirstHostname = yes
...
}
Walter Gross
22 April 2015, 09:25
Works, thank you very much Hugo!
This topic has been closed.