Typically, each website has its own WebGUI database, but there are some instances where it is advantageous to have ONE webgui database to serve up all your domains. This means that additional sites will be added via the asset manager to your "master site", but accessed through a different domain or subdomain. Here's how:
Set the vhost IP to the server's local IP. The config would not work with *.
Add the following lines under the block "#deal with port number in HTTP_HOST." Note that the last block replaces the existing "# proxy webgui pages" block.
RewriteRule ^/$ [MASTER_SITE]/[SUB_SITE]/ [P]
RewriteRule ^/(.*) [MASTER_SITE]/$1 [P]
# proxy webgui pages
RewriteRule ^/(.*) http://[MASTER_SITE]:8081/[SUB_SITE]$1 [P]
The WebGUI config file (/data/WebGUI/etc) and modperl config file (/data/wre/etc/) can both be safely removed after the above steps are completed. This will reduce SPECTRE connection errors.
Here is a good forum post with questions and answers about this topic.
http://www.webgui.org/etcetera/two-proxies-pointing-to-the-same-modperl
Keywords: apache mod_rewrite multi-site rewrite shared WRE
I've tried the above multi-site configuration, but I keep getting a RewriteRule loop error. Any ideas/suggestions would be greatly appreciated."
domain2.modproxy:
<VirtualHost *:80>
ServerName domain2
ServerAlias domain2-alias
CustomLog /data/domains/path/to/access.log combined
DocumentRoot /data/domains/domain1/public
# Turn on mod_rewrite
RewriteEngine On
# Rule to append 'index.html' onto base URL with or without "/"
RewriteRule ^(/*)$ /index.html [R]
# Remove initial /sub-page/ directory, if it exists in URL
# This can result from navigation links or relative URLs
### RewriteCond %{REQUEST_URI} ^(/sub-page/)(.*)$
RewriteCond %{REQUEST_URI} ^/sub-page/.*$
RewriteRule ^(.*)/sub-page/(.*)$ $1/$2 [R]
# Redirect all traffic to domain1/sub-page
RewriteRule ^/(.*) http://domain1/sub-page/$1 [P]
# (Add other rewrite rules as needed)...
# deal with port number in HTTP_HOST
RewriteCond %{HTTP_HOST} :80
RewriteRule ^/(.*) http://%{SERVER_NAME}/$1 [P]
# proxy webgui pages
RewriteRule ^/(.*) http://%{HTTP_HOST}:8081/$1 [P]
</VirtualHost>
domain2.modperl:
<VirtualHost *:8081>
ServerName domain2
ServerAlias domain2-alias
DocumentRoot /data/domains/domain1/public
SetEnvIf SSLPROXY "1" SSLPROXY
SetHandler perl-script
PerlInitHandler WebGUI
PerlSetVar WebguiConfig domain1.conf
</VirtualHost>
You will use the domain1.conf file for your second domain -- do NOT create a config file for domain2!
Restart WebGUI, and you should be good to go.
IMPORTANT NOTE: Be careful when using relative links in your sub-domain (for images, external documents, etc.). You may need to convert them to use an absolute address, instead.
If I missed something, or if you have questions, send a note to law-webmaster (at) umn.edu. -Tim
"