Tags:
create new tag
view all tags

Question

I have a working version of TWiki 4.0.2 running, but am having a URL mapping issue I would like to fix. I have setup a Virtual Host for my TWiki site using Apache 2 so that its address appears as "http://wiki.mydomain.org", but the TWiki appears to be rewriting the URLs as "http://mydomain.org/twiki/..." when accessed through a browser. I looked at the environment variables through the configure script and found that the HTTP_HOST variable is set to "mydomain.org". These variables are read only through the configure script, so how can I edit them? Or where does the configure script obtain the information for the environment variables (HTTP_HOST and SERVER_NAME in particular)? I have the correct domain already listed under 'DefaultUrlHost' in the 'General Path Settings'. The URL mapping is important as this TWiki site was recently moved from another server, and there are many links on other webpages that do not work because they are looking for the wiki.mydomain.org address. Other than the URL mapping the TWiki is working as expected.

Environment

TWiki version: TWikiRelease04x00x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian Linux (Sarge)
Web server: Apache 2
Perl version: Perl 5.8.4
Client OS: Windows, Linux
Web Browser: IE, Firefox 1.5
Categories: Hosting

-- MarkHolliman - 15 May 2006

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

The environment variables are not set by TWiki. They are all set by the web server (Apache in your case), and bin/configure just shows them as a debugging aid. This looks like your virtual server configuration is incomplete and "inherits" settings from the primary definitions.

-- HaraldJoerg - 15 May 2006

I've checked the VirtualHost settings, and they work for all the other virtual hosts on the server except for the TWiki (for instance the "forum.mydomain.org" VirtualHost works fine for the forum I have setup). How does the configure script know which VirtualHost it is supposed to inherit settings from? Is there a flag or some other way I can indicate to the script which information it should use?

-- MarkHolliman - 16 May 2006

Here is a mockup of my VirtualHost settings:

NameVirtualHost *:80
<VirtualHost *:80>
        ServerName mydomain.org
        ServerAdmin me@mydomain.org
        DocumentRoot /usr/share/www
</VirtualHost>

<VirtualHost *:80>
        ServerName wiki.mydomain.org
        ServerAdmin me@mydomain.org
        DocumentRoot /usr/share/www/twiki
        Redirect permanent / http://wiki.mydomain.org/bin/view
</VirtualHost>

<VirtualHost *:80>
        ServerName forum.mydomain.org
        ServerAdmin me@mydomain.org
        DocumentRoot /usr/share/www/forum
</VirtualHost>
-- MarkHolliman - 16 May 2006

Too much mockup: In your wiki.mydomain.org setting, you are explicitly redirecting all requests to the same server with bin/view added, resulting in an endless loop. You'd want at least something like this:

RedirectMatch permanent ^/$ http://wiki.mydomain.org/bin/view

To answer your question: Browsers send, in addition to the URL, the target host of their request, as given in their "location" field, as a separate "Host" header. From this header Apache knows which of its settings to use, and this is the setting Apache passes to $ENV{HTTP_HOST}.

If you redirect, then of target address of the redirection will appear at the browser's location field.

-- HaraldJoerg - 16 May 2006

Thanks for the help. The redirect works better now, and after some further digging it turns out the problem I'm having is related to a problematic DNS entry (the DNS record for my wiki.mydomain.org domain is pointing to two different addresses, one of which is incorrect).

-- MarkHolliman - 18 May 2006

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2006-05-18 - MarkHolliman
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.