Short URL to install Mediawiki in the web root

I have a Mediawiki installation running on my web root. For example. the main page can be accessed via

http://example.com/index.php?title=Main_Page

      

I would like to change it so that the short url is

http://example.com/Main_Page

      

My config looks like this

#.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ /index.php?title=$1 [PT,L,QSA]
RewriteRule ^.*$ /index.php [L,QSA]

      

...

// LocalSettings.php
$wgScriptPath = "..";
$wgArticlePath = "/$1";
$wgUsePathInfo = true;

      

But I am getting 500 error with this configuration.

This is the server that has the folder ~/user_root/

. This folder contains the public HTML files for the user's root domain, for example. user-root.com

...

The folder contains several sub-folders eg. In this case ~/user_root/example

, available at the URL above, example.com

.

Is the problem based on this folder / subfolder hierarchy and parameter $wgScriptPath

? If

$wgScriptPath = "..";

      

replace with something other than this relative path? Please advise if you need more information.

+3


source to share


1 answer


Yes, yours $wgScriptPath

is wrong. Using:

$wgScriptPath = "/";

      

Your rewrite rules also seem unlikely to you, especially that ^.*$ /index.php

(although it may be harmless, the last one).



If you are using the root URL instead of the normal short URL, you will need to use the following instead (to ensure that existing files and directories are not treated as an article, such as " /index.php

" " /images

" etc.):

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/w/index.php [L]

      

( Source )

+4


source







All Articles