Topic on Project:Support desk

ShortURL problems: 404 (used Redwerks)

10
2A02:A44B:DA4B:1:B0FE:484E:7A2F:350C (talkcontribs)

Hello,

I've been trying to set up a Short URL for my MediaWiki install. I am using the latest version of everything that is available to me; I am doing this on a private debian server so i have root access, etc. The Redwerks configuration generator has given me the following code:


RewriteEngine On

RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]

RewriteRule ^/?$ %{DOCUMENT_ROOT}/w/index.php [L]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d

RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d

RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]


as well as


$wgScriptPath = "/w";

$wgScriptExtension = ".php";

$wgArticlePath = "/wiki/$1";


and


$wgEnableUploads  = true;

$wgGenerateThumbnailOnParse = false;


As you can see, i am performing a fairly standard version of this process with my wiki installed at /w/ and intending to use /wiki/Page_name styled links. The root of my web server is /var/www/html. The RewriteRule stuff has been put in 000-default.conf inside /etc/apache2/sites-available.

All of this config should be correct as far as I know.


I then went into my apache2.conf and changed AllowOverride on all three blocks I could find there. I started out by only changing it for the third one (/var/www) but that did not work. Unfortunately, having all three changed to AllowOverride All did not fix my problem. (screenshot: http://g2f.nl/07vvtxd.png)


With all of the above, if all of the troubleshooting threads I have read are to be believed, it should work. However, it does not. I am completely stumped here, and could use some third party input. It would be much appreciated!

2A02:A44B:DA4B:1:B0FE:484E:7A2F:350C (talkcontribs)

I should clarify: As the thread title suggestions, what specifically isn't working is the fact that, when i visit the wiki using short URLs, I am getting 404 Not Found errors. I can however still visit the wiki using standard long-form index.php/Page_name type URLs.

2A02:A44B:DA4B:1:B0FE:484E:7A2F:350C (talkcontribs)

I have also tried using the .htaccess method, but that also did not work for me and resulted in the same 404 situation.

2A02:A44B:DA4B:1:B0FE:484E:7A2F:350C (talkcontribs)

I should also mention I have tried this with $wgUsePathInfo present as well and that did not change anything.

Ciencia Al Poder (talkcontribs)

This is strange. Rules look good to me. Did you restart the Apache service?

Note that all files in /etc/apache2/sites-available may bot be enabled. Look for /etc/apache2/sites-enabled

Be sure you put them in the relevant <Location> or <VirtualHost> section (one that's actually being used for the wiki, all of them if you have separate sections for http and https)

2A02:A44B:DA4B:1:B0FE:484E:7A2F:350C (talkcontribs)

I did indeed restart the service several times during this process, so that's definitely not the problem. As I tried the .htaccess method as well as the root method, and tried changing different configurations by ticking different boxes on the Redwerks generator, i each time restarted apache before checking.

In my sites-enabled, there are only symlinks to the files in sites-available, including 000-default which I edited. If I use a2ensite, i get the message that 000-default is already enabled.

In that file, there was already an existing rewriterule to redirect all requests to https. I placed the rewriterules generated by Redwerks in that same location, removing the "RewriteEngine on" as that line was already there from my prior rewrite rule.

(This was all located right above </VirtualHost> closing tag.)

2A02:A44B:DA4B:1:B0FE:484E:7A2F:350C (talkcontribs)

The thing is, I don't have a separate VirtualHost for https, so there's only really one file for me to edit here. The fact that the htaccess method ALSO doesn't work, leads me to believe something is going wrong on the "AllowOverride" side of things.


In the guide, I noticed this:

"If the path to your script directory is aliased by the webserver via an Alias directive, as it is in Debian among others, the RewriteRule will work as long as you add the PT flag (ie: change [L] to [PT,L]) to Pass Through the request to the next handler - mod_alias, which will correctly redirect the request, as per Stack Overflow"


I have not yet tried this. This might be what's going wrong. Will report back.

2A02:A44B:DA4B:1:B0FE:484E:7A2F:350C (talkcontribs)

Unfortunately, the above trick also didn't do it. Still getting a 404.

2A02:A44B:DA4B:1:B0FE:484E:7A2F:350C (talkcontribs)

I also tried the Alias method as outlined in the guide, to no avail.

2A02:A44B:DA4B:1:B0FE:484E:7A2F:350C (talkcontribs)

Never mind!!

I've been a bit of an idiot. I did not realize that 000-default-le-ssl was in fact my https VirtualHost.


Adding the rules to that file as well fixed the problem.

Thank you so much for pointing this out to me, or I would likely never have thought of checking that file.

This problem has been fixed now!