Manual:Short URL/nl

Korte URL's of URL Rewrites verbergen de extensie van het php-bestand in het pagina-adres. Denk een paar minuten na over een stabiele URL structuur voor uw website voordat u start, het voorkomt later problemen.

Doel
Het standaard installatie-pad ziet eruit als:


 * (geïnstalleerd als gebruiker root)
 * (geïnstalleerd met een gedeelde hosting provider)

Voorbeelden van het standaard pagina-adres:


 * (recente versies van MediaWiki, zonder CGI ondersteuning)
 * (recente versies van MediaWiki, met CGI ondersteuning)

Met gebruik van de methodes die op deze pagina zijn beschreven, kunnen we iets als dit configureren:


 * Dit is de meest gebruikelijke configuratie, hetzelfde als op de Wikipedia, maar niet de standaardconfiguratie vanwege de noodzaak om aan de server aanpassingen te doen.



Voordelen en nadelen

 * Voordelen: In een korte URL worden enkele technische details verborgen voor de eindgebruikers, wat aantrekkelijk kan zijn voor de eigenaren van een website. Dit kan betekenen dat ze meer stabiel zijn bij software wijzigingen. (Hierboven staat het verschil aangegeven tussen de standaard URL structuur met en zonder ingeschakelde CGI.) De leesbaarheid voor de lezer neemt toe, gemakkelijker te onthouden en te manipuleren. Korte URL's hebben daarnaast een voordeel boven de standaard URL's bij de zoekmachine optimalisatie, omdat URL's die een  bevatten als minder aantrekkelijk worden gezien door zoekmachines bij het bepalen van de volgorde als zoekresultaat.
 * Nadelen: Er is configuratie nodig, dus afhankelijk van de door u gebruikte hosting omgeving, kan het moeilijk opnieuw aan te maken zijn. Als elke veel gebruikte webserver korte URL's kan configureren, dan zou een betaalde hosting provider dit ook moeten ondersteunen. Anders wordt het tijd om een andere te zoeken.

Handleidingen
Our official guides for short URL configuration for different web servers. Pick your web server's configuration from this list. If you don't know what server software you are using, then it is most likely Apache.


 * ( or LiteSpeed)



Andere korte handleidingen

 *  These guides are old and are almost entirely bad advice. These will eventually be deleted one by one as our official guides above are created for different webservers. 

Anyone is welcome to create a how-to solution page and list it below. Please use a sensible name for the page, one that fits in with the below names. When each unique solution has its own page, readers can skip complexity they do not want. Keep it simple, readable, short, with a separate page per separate solution.

To help others find out which Short URL methods really work, after trying each method please edit the page and increase the "worked" or "didn't_work" numbers for that guide and make a brief (or long, your choice) description on what went wrong by clicking the link on your number.



URL als: example.com/wiki/Page_title


Root toegang
These methods require that you have access to the server configuration. If you are on a shared host, you most likely don't. In this case you will be required to use a method that requires "no root access". You can jump directly to the MediaWiki ShortURL Builder tool and follow the on-screen instructions. Select "I don't have root access" after entering your wiki's URL.

(for Apache guidance, see the link in the Guides section).



URL als: example.com/Page_title
How to create  URLs:



URL als: wiki.example.com/Page_title
How to create  URLs:

Probleemoplossing


Ampersand (&) probleem
The ampersand problem shows up when you have page titles with symbols in them (such as &, ?, #, + and /) which, despite being correctly encoded in the link, are not being passed correctly from mod_rewrite to the script. This manifests in 404 page-not-found errors, because the title gets cut off at the special character. For example, clicking on a link to "John & Maria's page" gets a 404, because MediaWiki is looking for a page named "John ".

This is because ampersands in long-form names are treated as query string separators, and would never reach the PHP runtime environment. This is caused by an old and problematic mod_rewrite bug.

Solution:

This issue is caused by the  portion of rewrite rules like   which is completely unnecessary and harmful. MediaWiki parses paths directly from the REQUEST_URI, so rewrite everything to /index.php.



Cache legen
If you notice that your changes to  in LocalSettings.php are not being reflected in mysite.com/wiki/Main_Page, it may be due to MediaWiki's caching of the links according to previous settings.

Go to mysite.com/wiki/Main_Page?action=purge to force MediaWiki to regenerate the cached links.

Also you can:


 * 1) execute the MySQL query "TRUNCATE objectcache;", or
 * 1) Ensure  is updated (if  is enabled, all you have to do is edit  to purge it)



Bezoeker van uw domein doorverwijzen naar uw wiki
Our official guides for short url configuration include recommendations on how to point the root of your site to your wiki using your short url config.

For example our Apache guide recommends using this to point your site root to your wiki:

Note that we do not recommend doing a HTTP redirect to your wiki path or main page directly. As redirecting to the main page directly will hard-code variable parts of your wiki's page setup into your server config. And redirecting to the wiki path will result in two redirects. Simply rewrite the root path to MediaWiki and it will take care of the 301 redirect to the main page itself.

If using VirtualHosts, place the rewrite rules into the virtual host declaration!



Een wiki verplaatsen van "/wiki" naar "/w"
A common beginner's mistake is to install MediaWiki itself (the source code, not the short URL) in  instead of. Once installed they would realize the mistake when trying to configure Short URLs (which would become difficult as the virtual path then conflicts with the real path).

There is a manual for moving a wiki in general, however that is too complicated if all you need is to change the installation directory (and stay on the same server, same database and same hostname).

Here is what you have to do:

Edit a page, visit a few different pages, etc. If anything seems abnormal, revert the changes by restoring your backup of  and other relevant files you might have changed during configuration of short URLs and rename your folder back to.
 * Backup  and any other config files you may have created (such as your  ).
 * Rename the installation directory of MediaWiki on your server from  to.
 * Set  in   to   and remove (or comment out) any definition of   (this variable will be changed again when setting up Short URLs, further on)
 * At this point your wiki should be working normally at
 * Now go through the regular guide to set up short URLs
 * Perform a few tests on your wiki to make sure nothing is broken.

Note for shared hosting users: Many shared hosting plans offer an application manager to automatically Install, Update and Backup applications such as MediaWiki. If your plan has this and if you want to keep using these features, you should contact their tech support and let them know you just manually changed your MediaWiki installation directory.

Trucs


Zie ook

 * Explanation of what CGI modules are
 * - configuration setting that defines whether to use 'pretty' URLs or not
 * Notes on placing your wiki installation in site root directory
 * - configuration setting that you can use to define 'pretty' URLs for other actions, like edit or history
 * Clean up URLs RFC - proposes "cleaner URLs for editing, previewing skins, etc."



Externe links

 * Apache Module mod_rewrite - rewrite requested URLs on the fly
 * MediaWiki Short URL Builder Tool - A tool that can automatically generate a short url configuration more reliably than the configurations in these manual pages.
 * URL as UI by Jakob Nielsen on the importance of persistent, usable URLs.