Jump to content
MediaWiki

Topic on Project:Support desk/Flow

multiple domains pointing to the same wiki (apache/wiki configuration)

8
Loizbec (talk contribs )

I have a wiki that is configured for short urls and just as I want it : some pages are readable by the world, the rest is just visible by those who work on the various projects it hosts. Let's say its url is mywiki.myinstitution.net

I ended up creating my webpage on that wiki and I want all the subpages of my user page to have the same domain name, which is different from the main wiki domain name (for instance me.myinstitution.com).

I started by defining rewriting rules with full urls :

#Current working (albeit redirect) configuration
<VirtualHost me.myinstitution.com:80>
 ServerName me.myinstitution.com
 RewriteEngine On
 RewriteRule "^/*$" "http://mywiki.myinstitution.net/wk/User:Me"
 RewriteRule "^(/.*)" "http://mywiki.myinstitution.net/wk/User:Me1ドル"
</VirtualHost>

but apache considers them as redirections, so they don't do exactly what I would like them to. The problem is that when I change them to the type of rewrites that will not be redirections, they obviously conflict with the global configuration of the wiki, and the pages are not even allowed access for anonymous users...

 #example of type of rewrite I would like, not that I know if it would work in any way
 #but I want me.myinstitution.com to show exactly what mywiki.myinstitution.com/w/User:Me shows
 RewriteRule "^/*$" "/var/www/html/w/index.php/User:Me"

Is there hope to find a solution for my problem ?

NB : the configuration file looks like the following :

#Current working configuration
<VirtualHost mywiki.myinstitution.net:80>
 ServerName mywiki.myinstitution.net
 ServerAdmin me@myinstitution.net
 DocumentRoot /var/www/html
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined
 <Directory /var/www/html/w/>
 Options FollowSymLinks 
 </Directory>
 RewriteEngine On
 RewriteRule ^/?wk(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
 # Redirect / to Main Page
 RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]
</VirtualHost>

Thanks for any input...

MarkAHershberger (talk contribs )

Have a look at MEZA, a deployment system put together by some MediaWiki administrators at NASA for managing multiple wikis (with different access needs) for their own use.

Loizbec (talk contribs )

It seems very powerful, but it does not seem to say it does what I need...

Bawolff (talk contribs )

In LocalSettings.php add some code that looks at what the current path is (via $_SERVER) and uses an if statement to set $wgServer

Its quite a bit more complex if you want to also change the article/script path

Loizbec (talk contribs )

Very good idea to have separate configurations based on the http query. But I haven't found out how to restrict a wiki to a specific namespace (or more precisely to a page and its subpages), too many variables to consider :

  • apache rewrite rules ;
  • scriptPath ;
  • articlepath ;
  • etc.

If I could configure my wiki so that the root of the wiki is the article User:Me and that every other query is a subpage of that, I'd probably be able to make the if statement necessary for my multiple wikis, but I don't understand mediawiki enough...

Thanks anyway Loizbec (talk) 14:26, 24 July 2019 (UTC)

Loizbec (talk contribs )

So to sum up, I would need a configuration that would restrict my wiki to the subpages of my User page :

  • http://me.myinstitution.com points to the article User:Me of the wiki (formerly known as http://mywiki.myinstitution.com/w/User:Me)
  • http://me.myinstitution.com/subpage points to the article User:Me/subpage of the wiki (formerly known as http://mywiki.myinstitution.com/w/User:Me/supbpage)
Simonsarazin (talk contribs )

Hi @Loizbec, did you found a solution to do it ? Thanks a lot.

Loizbec (talk contribs )

Hi @Simonsarazin,

Sorry, I haven't replied earlier, I have postponed finding a solution to that problem for so long that it is just as if I have given up on it :-S.

If I ever relaunch that project, I'll keep you posted...

AltStyle によって変換されたページ (->オリジナル) /