DigitalOcean Mediawiki ShortURL
-
I come to you guys hoping someone has made this work.
I have a digitalocean account. I love it. I'm hosting a few things there, like the BJ Zanzibar backup, a couple of personal wikis for tabletop games, and some other stuff.
I cannot get any form of mediawiki shorturl function to work. It always, always, breaks.
I'm using CentOS 7, ngnix and the standard setup in these two tutorials:
https://www.digitalocean.com/community/tutorials/how-to-install-mediawiki-on-centos-7https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7
I tried with root access. I tried with the non-root .htaccess.
I can't get it to work at all.
Anyone actually gotten this to work on digitalocean?
-
I've gotten it to work, but on Ubuntu. I am no help at all with CentOS. Not much help with general Ubuntu, either, but had managed this on it. Hopefully someone familiar with CentOS will chime in.
-
This is apache config, doesn't really have anything to do with what distribution or host you have.
Have you seen: https://www.mediawiki.org/wiki/Manual:Short_URL/Apache
-
Yeah. I have used that guideline plus the redworks setup and still no luck. It WORKS and redirects just fine... and just gives me a 404, like it's not processing the php file.
-
@bobotron Where is your actual wiki installation, the full path to the php?
EDIT: Oh wait, you said nginx. I don't know anything about setting it up for nginx.
-
Nah, I'm using apache. httpd.
My wiki is site/mw/index.php/Article
I'm just trying to remove the /index.php/
-
This help at all? http://musoapbox.net/topic/2298/mediawiki-changing-index-php
I appreciate you commented on the thread saying you'd give it a try. But, that's what worked for me (on Ubuntu). @surreality gives another version that the original site I link handles, and is flagged as the "if you don't have root access" method. One or the other should work... I hope? -
@bobotron said in DigitalOcean Mediawiki ShortURL:
Nah, I'm using apache. httpd.
Oh, your first post mentioned nginx.
My wiki is site/mw/index.php/Article
I'm just trying to remove the /index.php/
I know what you're trying to do
What's your rewrite rules?
The reason I ask is because you don't remove index.php -- you map /wiki/foo to /mw/index.php/foo, that's how this short names work.
-
@skew
I tried to use what you posted and realized that mine is installed differently than yours, and I was missing the stuff to put into the LocalSettings.php so it didn't work.@ixokai
I am not really a server admin. I think I posted ngnix thinking that I had installed it to get the Apache I got? I installed CentOS 7 because it was suggested to be the easiest one for PennMUSH to be installed/used with.I use httpd to mess with my stuff, like apachectl to restart it when I make changes. I'm far from a server admin, so I'm kinda blind when it comes to crazy changes.
The rewrite rules it's giving me are:
RewriteEngine On
RewriteRule ^/?mw/wiki(/.*)?$ %{DOCUMENT_ROOT}/mw/index.php [L]RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?mw/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/mw/thumb.php?f=$1&width=$2 [L,QSA,B]RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?mw/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/mw/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]And the LocalSettings stuff:
$wgScriptPath = "/mw";
$wgScriptExtension = ".php";
$wgArticlePath = "{$wgScriptPath}/wiki/$1";When I enter all that, it returns a 404 Not Found error, but it does remove the index.php from the site.
-
@bobotron Okay yeah the issue is you're not doing what the instructions are telling you to.
With the short urls, the "real" mediawiki lives in /w (/mw is fine), but everyone accesses it almost exclusively via /wiki -- which notably doesn't exist. Whenever Apache gets http://foo/wiki/Blah it rewrites it into a call to http://foo/w/index.php.
I refer you to https://www.mediawiki.org/wiki/Manual:Short_URL/Apache again:
You have:
RewriteRule ^/?mw/wiki(/.*)?$ %{DOCUMENT_ROOT}/mw/index.php [L]
What you need to have:
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/mw/index.php [L]
You're combining 'mw' (actual installation) with 'wiki' (rewrite aliases) into one thing and its breaking.
In your LocalSettings.php, you want:
$wgScriptPath = "/mw";
$wgArticlePath = "/wiki/$1";Now you have a lot of other rules that there about images that I'm not sure what they do, I don't use them and haven't ever seen them so I wonder where you're getting these rule-sets from when you say "it's" giving me?
-
The redworks shorturl creator is filling in an image 404 handler; I can unclick the option, as I've never had 404 image errors but felt it was worth keeping in just in case.
I realize what I posted was reset, as I forgot to pull /wiki/ out of it as I was trying to just remove the index.php section (if I can't rewrite to just point to /mw/ that's fine, I can point to wiki without issue).
And I had read over that, and kept looking at it and it seemed to match what the redworks builder was giving me. Even going back in and making the directory /wiki/Article, it still doesn't work. What you gave me matches up with what redworks outputs, but I still jut get a 404 Not Found error when it rewrites/redirects. What I have currently:
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/mw/index.php [L]
RewriteRule ^/?$ %{DOCUMENT_ROOT}/mw/index.php [L](I have the above, above my SSL stuff in my site.conf file).
$wgScriptPath = "/mw";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";Still just a 404 error, but it does rewrite (I go to mw and it rewrites to wiki/Main_Page and gives me a 404). I also tried it without that second rewriterule line and it still does the same.
-
@bobotron said in DigitalOcean Mediawiki ShortURL:
And I had read over that, and kept looking at it and it seemed to match what the redworks builder was giving me. Even going back in and making the directory /wiki/Article, it still doesn't work.
I'm confused, what do you mean 'making the directory /wiki/Article'? The whole point of this is those don't exist?
Otherwise, I'm leaning towards stumped
-
Currently the wiki is stored in site.com/mw
The site loads as: site.com/mw/index.php/Article
The goal is to be: site.com/wiki/ArticeUsing the options provided by the ShortURL builder (which looks like it matches up with what you provided), I get:
site.com/wiki/Main_Page (for example) with a 404 Not Found error.
The options I'm using are (in site.conf above my SSL):
RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/mw/index.php [L]
RewriteRule ^/?$ %{DOCUMENT_ROOT}/mw/index.php [L]In LocalSettings.php:
$wgScriptPath = "/mw";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1"; -
@bobotron said in DigitalOcean Mediawiki ShortURL:
Currently the wiki is stored in site.com/mw
The site loads as: site.com/mw/index.php/Article
The goal is to be: site.com/wiki/ArticeI don't know why you keep telling me this. I have known this since your first post.
I said I'm leaning towards stumped as to why you're getting a 404, not that you need to re-explain the information you've already given.
Are you configuring this in a .htaccess or in an apache config file?
-
Oh, my bad. Sorry, I thought the two different things I had posted about the setup might've been getting crossed. It's in the game.conf virtual host config file. I also tried the .htaccess version and it didn't work either. I know mod_rewrite is enabled, which was the first thing suggested to me.
-
@bobotron said in DigitalOcean Mediawiki ShortURL:
Oh, my bad. Sorry, I thought the two different things I had posted about the setup might've been getting crossed. It's in the game.conf virtual host config file. I also tried the .htaccess version and it didn't work either. I know mod_rewrite is enabled, which was the first thing suggested to me.
Can you pastebin your site.conf? I can't think of anything else but looking at the whole config
-
I wonder if my SSL is messing with it? I wouldn't think so, but...
-
While I really don't have any idea how any of this works... I do notice that site/mw/index.php/article is not site/index.php/article, the latter obviously being what the "most common" mediawiki setup seems to be.
Could be you need to go about this a very different way if you want to do site/wiki/article. More likely, you'll have success with site/mw/wiki/article?
-
@bobotron said in DigitalOcean Mediawiki ShortURL:
I wonder if my SSL is messing with it? I wouldn't think so, but...
No, because that's not a site's ssl configuration (and in general, ssl and rewrite work together fine)
Aaand...
Just to be for sure safe, from the server can you:
ls /var/www/v5game/public_html/mw/index.php
and see a file?
@skew said in DigitalOcean Mediawiki ShortURL:
While I really don't have any idea how any of this works... I do notice that site/mw/index.php/article is not site/index.php/article, the latter obviously being what the "most common" mediawiki setup seems to be.
The index.php shortening is a hack, but works, but ew. No, /wiki is incredibly common.
Could be you need to go about this a very different way if you want to do site/wiki/article. More likely, you'll have success with site/mw/wiki/article?
Not that wouldn't work at all. @Bobotron is going about it the recommended and right way, its just not working (and I don't know why)
-
@ixokai
I got:[elmerg@hotbmush-host mw]$ ls /var/www/v5game/public_html/mw/index.php
/var/www/v5game/public_html/mw/index.php
[elmerg@hotbmush-host mw]$