Topic on Manual talk:Short URL/Apache

ShortURL constantly returns 404 Not Found

9
98.21.171.79 (talkcontribs)

CentOS7

MediaWiki 1.30.0

PHP 7.1.16 (apache2handler)

MariaDB 5.5.56-MariaDB

ICU 50.1.2

I have a mediawiki running on a directory, /mw/ and it generates the /mw/index.php/Article

I just want to remove the index.php section.

I have root access and have run Redworks' ShortURL tool. My ShortURL stuff to go into my virtual host is as follows:

RewriteEngine On

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

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

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

And my LocalSettings.php

$wgScriptPath = "/mw";

$wgScriptExtension = ".php";

$wgArticlePath = "{$wgScriptPath}/$1";

It seems to work, but I constantly get a 404 Not Found error. It redirects but doesn't actually process.

I cannot get it to work no matter what. Any help would be appreciated.

Ciencia Al Poder (talkcontribs)

If your index.php path is at /mw/index.php, you should't make your URLs look like /mw/$1, because this is a source of conflicts.

Please choose a different scheme, for example, articles in /wiki/$1

98.21.171.79 (talkcontribs)

I did. Even using /wiki/$1 I get a 404 Not Found error. Below is my info:

RewriteEngine On

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

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

$wgScriptPath = "/mw";

$wgScriptExtension = ".php";

$wgArticlePath = "/wiki/$1";

It writes to /wiki/ fine but I still get a 404 error.

Ciencia Al Poder (talkcontribs)

The configuration looks good.

If you access the "/mw/index.php" path from your browser, does it display the main page?

98.21.171.79 (talkcontribs)

If I put index.php/Main_Page, yes.

If I put index.php/ it redirects around as /wiki/

Ciencia Al Poder (talkcontribs)

Be sure there's no folder named "wiki" on the webserver

98.21.171.79 (talkcontribs)

There isn't.


Ciencia Al Poder (talkcontribs)

I think your rewrite rules are not being taken into account by the webserver. Maybe server admin disabled the ability to override/create rewrite rules.

81.163.151.85 (talkcontribs)

Провозился 2 дня. Всё делал как в инструкциях... Переустанавливал вики, специально в подкаталог "w". Всё время выдавало 404, при этом путь менялся как нужно //сайт/wiki/Page_title

Настраивал через .htaccess . В итоге просто нужно .htaccess поместить рядом с папкой "w". До этого был на каталог выше. После всё заработало.