Topic on Project:Support desk

domain of URL automatically replaced by servername (IMHO not a apache redirect issue)

6
TimBanchi (talkcontribs)

Hello,

I really searched well because it seems a simple problem. The only thing I know is that is isn't an apache redirect thing (redirect works but AFAIK I don't need redirect).

In short: I want that my domain name stays in the URL of the browser. Right now, it gets changed to the server-name as soon as I access the wiki. I think it is the wiki who does this but I don't know how to change the behaviour.

A) Setup: Ubuntu 12.04 server LTS 1)Mediawiki:
MediaWiki 1.24.0
PHP 5.3.10-1ubuntu3.15 (apache2handler)
MySQL 5.5.40-0ubuntu0.12.04.1

Entry points:
Article path /mediawiki/index.php/$1
Script path /mediawiki
index.php /mediawiki/index.php
api.php /mediawiki/api.php
load.php /mediawiki/load.php

2) apache config:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName wiki.mydomain.com
        ServerAlias mywiki

        DocumentRoot /var/www/mediawiki/

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride NoneInsert non-formatted text here
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

3) LocalSettings.php: it is a fresh wiki, so nothing special is edited here. I have the following parameters set:

$wgMetaNamespace = "my_fancy_wiki";

$wgScriptPath = "/mediawiki";
$wgScriptExtension = ".php";

## The protocol and server name to use in fully-qualified URLs
$wgServer = "http://lorette"; ##<== this is the name of the webserver

## The relative URL path to the skins directory
$wgStylePath = "$wgScriptPath/skins";

B) current outcome:
1) I access the mediawiki via http://wiki.mydomain.com.
2) the page is correctly shown but the URL in the browser changes to
http://lorette/mediawiki/index.php/my_fancy_wiki

C) wished outcome:
1) I access the mediawiki via http://wiki.mydomain.com.
2) the domain-part of the URL stays the same, eg: http://wiki.mydomain.com/index.php/my_fancy_wiki

it is an intranet site and I have an appropriate AAA record set to have the domain point to the IP.

Florianschmidtwelzow (talkcontribs)

Hello,

change $wgServer to the domain you want to use ;)

TimBanchi (talkcontribs)
Florianschmidtwelzow (talkcontribs)

Your document root is already /var/www/mediawiki (DocumentRoot /var/www/mediawiki/), so are you sure, that your script path is $wgScriptPath = "/mediawiki";??? So your wiki's root is /var/www/mediawiki/mediawiki?

TimBanchi (talkcontribs)

Florian, thank you so much :) I knew it was something stupid. I just didn't understand that the scriptpath is (I guess) relative to documentRoot, so I didn't see it.

I changed $wgScriptPath to: $wgScriptPath = "";

and $wgServer to: $wgServer = "http://wiki.mydomain.com";

the wiki works and the url looks much nicer: http://wiki.mydomain.com/index.php/my_fancy_wiki

DONE!

Reply to "domain of URL automatically replaced by servername (IMHO not a apache redirect issue)"