https://bugzilla.wikimedia.org/show_bug.cgi?id=46495
Web browser: ---
Bug ID: 46495
Summary: Auto-detect the server name so as to access the wiki
both via localhost and via ip
Product: MediaWiki
Version: 1.20.3
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: enhancement
Priority: Unprioritized
Component: Installer
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Mobile Platform: ---
Today I turned my computer into a home server, so now I can access my localhost
by entering my public IP address, say http://123.123.123.123/ It works fine, I
can access my localhost and all the websites stored in it.
Then I went to http://localhost/wiki/ and installed a wiki there. It all went
fine. However, when I tried to access the wiki from
http://123.123.123.123/wiki/, I got redirected to http://localhost/wiki/
So I tried installing the wiki again, this time at
http://123.123.123.123/wiki/. What happened was that I could access the wiki
through http://123.123.123.123/wiki, but when I went to http://localhost/wiki/,
I got redirected to http://123.123.123.123/wiki/
So I looked into LocalSettings.php, and found that the server name (either
http://123.123.123.123/ or http://localhost/) was hard coded at $wgServer. I
tried changing its value to $wgServer = 'http://' . $_SERVER['SERVER_NAME'],
and was glad to find out that now I could access my wiki from both
http://123.123.123.123/wiki/ and http://localhost/wiki/
It seems like an easy solution, but I would like other developer's opinion.
Should I push this change? Is there some reason I'm not seeing for keeping the
server name hard coded?
Two notes:
* I noticed that if I run the installer from http://localhost/wiki/, then I
said, I can't go to http://123.123.123.123/wiki/ without getting redirected,
but I CAN go to http://123.123.123.123/wiki/index.php/Main_Page and not get
redirected. Also, I can then navigate through the wiki without getting
redirected. Same if I run the installer from http://123.123.123.123/wiki/ and
then go to http://localhost/wiki/index.php/Main_Page
* I tried the same steps with a WordPress installation, and WordPress had no
problems.
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l