Changing entry point URLs
-
Hi. I would like to remove the
/wiki/in my site's URL:https:example.com/wiki/some_page->https://example.com/some_pageI added two variables in
app/data/LocalSettings.php:$wgArticlePath = '/$1'; $wgScriptPath = '/';After a restart, the
https:example.comlanding page loads but without any CSS style. All other pages behind/wiki/did not "move" and do not exist at the new URLs.On the mediawiki one step in the process is "Rename the installation directory of MediaWiki on your server from /wiki to /w [i.e. / in my case]." How can I do that ?
EDIT: with
$wgScriptPath = '';the stylesheet is loaded. -
Hello @mononym
I have investigated this issue and found the following.According to my understanding after reading the documentation the
LocalSettings.phpshould include the following:# Set the script path to root $wgScriptPath = ""; # Set the article path for pretty URLs $wgArticlePath = "/$1"; # If you're using a different entry point than index.php $wgScript = "/index.php"; # For resource loading $wgResourceBasePath = $wgScriptPath;Just for good measure I also cleared the
Main Pagecache with:php maintenance/run.php purgePage <<< "Main Page"But sadly, this did also not work.
So the only thing now breaking it could be the apache2 config and there it is.By default (not editable) - https://git.cloudron.io/packages/mediawiki-app/-/blob/master/apache/mediawiki.conf?ref_type=heads:
ServerName %{HTTP_HOST} <VirtualHost *:8000> DocumentRoot /app/code LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy CustomLog "|/bin/cat" proxy ErrorLog "|/bin/cat" # https://www.mediawiki.org/wiki/Manual:Security php_flag register_globals off ## http://www.mediawiki.org/wiki/Manual:Short_URL/Apache RewriteEngine On RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L] RewriteRule ^/*$ %{DOCUMENT_ROOT}/index.php [L] <Directory /app/code> Options +FollowSymLinks AllowOverride All Require all granted </Directory> # some directories must be protected # images/ still has to be accessible since mw references it directly <Directory /app/code/images> Options -FollowSymLinks AllowOverride None <IfModule mod_php7.c> php_admin_flag engine off </IfModule> </Directory> </VirtualHost>I put the app into recovery mode and edited the Apache2 site file and changed the rewrite to the following:
RewriteEngine On RewriteCond %{REQUEST_URI} !^/rest\.php RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L]and started the app with
/app/pkg/start.shand got a working MediaWiki undersub.DOMAIN.tld/Main_Page.
To make this usable for you and everyone else, an app update would be needed where users, like you, could also upload a custom Apache2 site setting file that will be included to overwrite the default one.
I am converting / hijacking this topic into a feature request.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login