Hey Platonides,
thanks for the tips.
Strangely enough this morning calling <http://mywiki.com/> (without
www.) works fine and redirects to the main page. I swear I do not
sleepwalk and did not change anything in my sleep, so I do not
understand why now it is working. Some caching issues in my browser
maybe? Hmmm ....
Anyway, another question:
If I call the root, with or without www., I get redirected to the main
page without www. But if I call content with www., I get the content with www.
You say I can set a canonical URL (either with or without www.) in
$wgServer. This is not defined in my LocalSettings.php, so I guess
mediawiki falls back on DefaultSettings.php, where there is this code snippet:
---code---------------
/** URL of the server. It will be automatically built including https mode */
$wgServer = '';
if( isset( $_SERVER['SERVER_NAME'] ) ) {
$wgServerName = $_SERVER['SERVER_NAME'];
} elseif( isset( $_SERVER['HOSTNAME'] ) ) {
$wgServerName = $_SERVER['HOSTNAME'];
} elseif( isset( $_SERVER['HTTP_HOST'] ) ) {
$wgServerName = $_SERVER['HTTP_HOST'];
} elseif( isset( $_SERVER['SERVER_ADDR'] ) ) {
$wgServerName = $_SERVER['SERVER_ADDR'];
} else {
$wgServerName = 'localhost';
}
# check if server use https:
$wgProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ==
'on') ?
'https' : 'http';
$wgServer = $wgProto.'://' . $wgServerName;
# If the port is a non-standard one, add it to the URL
if( isset( $_SERVER['SERVER_PORT'] )
&& !strpos( $wgServerName, ':' )
&& ( ( $wgProto == 'http' &&
$_SERVER['SERVER_PORT'] != 80 )
|| ( $wgProto == 'https' && $_SERVER['SERVER_PORT'] != 443 ) ) )
{
$wgServer .= ":" . $_SERVER['SERVER_PORT'];
---/code--------------
If I set $wgServer = 'http://mywiki.com'; in LocalSettings.php, there is
no change that I can percieve: I don't get redirected from <http://
www.mywiki.com/wiki/Mainpage> to <http://mywiki.com/wiki/Mainpage>, and
the links on <http://www.mywiki.com/wiki/Mainpage> all point to other
www. pages.
So, what does $wgServer actually do, when I define it, and should I
use .htaccess to redirect from with-www. to without?
Also, if I log in at <http://mywiki.com/wiki/Mainpage>, if I call
<http://www.mywiki.com/wiki/Mainpage>, I am not logged it. Why is that?
~ Manfred
Manfred Kooistra wrote:
Hello,
I have just installed mediawiki on my site and it is running fine so
far, except this one strange behaviour, maybe you can help me:
When I access the site with "www", using <http://www.mywiki.com/>, I get
redirected to <http://mywiki.com/wiki/Mainpage> (without "www"), but
when I access the site without "www", using only <http://mywiki.com/>,
all I get is a blank page.
Accessing any content (e.g. <http://mywiki.com/wiki/Article>) with or
without "www" gives me the same page and works fine.
Why is that? Why redirection from with to without "www",
Mediawiki expects a canonical URL and redirects the other to it. You can
change that URL on LocalSettings.php ($wgServer)
and why a blank page?
Blank page = php error
Check the error log for the exact reason.
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l