Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. MediaWiki
  3. Changing entry point URLs

Changing entry point URLs

Scheduled Pinned Locked Moved MediaWiki
feature-request
2 Posts 2 Posters 515 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mononym
    wrote on last edited by mononym
    #1

    Hi. I would like to remove the /wiki/ in my site's URL: https:example.com/wiki/some_page -> https://example.com/some_page

    I added two variables in app/data/LocalSettings.php:

    $wgArticlePath = '/$1';
    $wgScriptPath = '/';
    

    After a restart, the https:example.com landing 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.

    1 Reply Last reply
    1
    • jamesJ Offline
      jamesJ Offline
      james
      Staff
      wrote on last edited by james
      #2

      Hello @mononym
      I have investigated this issue and found the following.

      According to my understanding after reading the documentation the LocalSettings.php should 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 Page cache 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.sh and got a working MediaWiki under sub.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.

      1 Reply Last reply
      2

      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
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Bookmarks
      • Search