Manual talk:Short URL/Old discussion page

READ THIS FIRST IF YOU HAVE A TECHNICAL QUESTION This talk page is not very active. You probably WILL NOT get an answer to your question. It is better to go to MediaWiki_on_IRC where there are live people 24/7, and ask your question there. Odessaukrain 00:26, 9 October 2007 (UTC)

Hard To Understand?
Read Easy:Manual:Short URL

Short URLs for MediaWiki on a subdomain, where wiki is several directories down
If anyone can provide the killer rewrite rule, I will email them a free coffee;-) I have a MediaWiki installed on a subdomain (actually, a sub.sub.doman.com) in a sub sub directory ( so its actually located at subdom.subdom.domain.com/subdir/wiki )... getting rewrites to work is proving to be a challenge... hopefully, a coffee addict will read this and swing Tarzan-like to the rescue...

404 error when i try to see image bigger
hello, i use this methode (Page title -- PHP as a CGI module, no root access) all seems to works fine. But i've got two problems :
 * i cant put a dot in my link (example : See More.) it will not works. its not very important because i can fix it just changing the name of the page
 * the most important thing is that when i click on images to see them bigger, i have a 404 error. The link is like that www.mysite.Com/wiki/Image:Name.jpg. How can i stop this error ?

thxs (sorry i'm not english)

please
please please finish this somebody

This article is getting too long -- please use subpages
The article is getting unreadable, unmaintainable, long and confusing.

''Please use subpages -- please write separate maintainable Short URL how to solutions on subpages per pagenaming scheme described on Manual:Short URL overview and link to such pages there. A separate subpage per Short URL how to will be more readable and maintainable. We need to do this because of the numerous solutions -- management of complexity. Thanks for your help -- please put your own solution on a subpage! See Manual:Short URL overview for how to name subpages and link to them there. That page will become the new Manual:Short URL page once sufficient Short URL solution subpages, including yours, are created. Thank you!'' :-) --Rogerhc 06:52, 3 September 2007 (UTC)

Which is better?
Right at the top it says "These methods assume that you don't have access to the server configuration (for example, if you're on a shared host); if you do, see 'Root access' below." That phrasing kind of implies that if you do have root access you should take advantage of it and use the second method. Is that correct? Is one method better than to the other? The non-root directions seem simpler, and for a low-traffic site, performance and efficiency are not issues.

How I can configure for xampp
I have folder wiki in htdocs. How I can access to russian articles without index.php? 83.219.129.26

I don't know if it is your problem, but I (not knowing anything about xampp etc.) had quite a problem getting the recommended short url solution to work. Problem was that in my installation (xampp with mediawiki 1.11.0) by default (used the graphical installers) a extra conf for my wiki was created in apache/conf/extra/ and then imported into httpd.conf Therefor, there existed a alias in the seperate wiki-conf which overwrote my new alias (put into httpd.conf following the instructions). And because I did not look at any warnings etc. when starting apache I never knew what was going wrong :)

MediaWiki 1.82 .htaccess method for wikis stored in subfolder of root
I have gotten Mediawiki Pretty URLs to work here at by using this configuration. I have my wiki in the wiki5 folder. I'm running, MediaWiki 1.82

Add to .htaccess

AddHandler application/x-httpd-php5 .php

The above line directs all php files to processed using PHP5

RewriteCond %{HTTP_HOST} ^muscatelli.info/wiki5 RewriteRule ^(.*)$ http://www.muscatelli.info/wiki5/$1 [r=301,L]
 * 1) Redirect http://muscatelli.info to http://www.muscatelli.info

Note: the above is used to redirect all addresses with the www removed to [www.muscatelli.info] to help Google Ranking and is not necessary for the code to work! Also note that my wiki is in the directory: wiki5

RewriteRule ^[^:]*\. - [L] RewriteRule ^[^:]*\/ - [L] RewriteRule ^/*$ /wiki5/index.php?title=Main_Page [L,QSA] RewriteRule ^(.+)$ /wiki5/index.php?title=$1 [L,QSA]
 * 1) anything that contains a dot without a colon should be left alone
 * 1) anything that contains a slash without a colon should be left alone
 * 1) redirect to main page
 * 1) anything else is to be treated as a title
 * 1) anything that contains a slash is to be left alone.

Change in LocalSettings:

$wgArticlePath     = "$wgScriptPath/$1";

Rewrite Okay, recognition not
Heyho,

i have tried various rewrite methods now, including the one mentioned above. So, now the rewriting itself works fine, but the wiki refuses to notice the move (LocalSettings.php was modified too), instead keeps telling me that https://server_name/wiki/Main_Page could not be found. However, when manually entering index.php?Main_Page instead of just Main_Page it works fine again, so i assume the problem is limited to the wiki itself. Any ideas how to solve it?
 * I have exactly the same problem. --194.19.86.146 10:08, 14 February 2007 (UTC)

Excactly the same Problem. --87.123.135.136 22:04, 19 February 2007 (UTC)
 * I have the same probleme--86.193.126.194 00:25, 15 April 2007 (UTC)
 * Same problem here.

I'm just trying to get mine set up for the first time, and it's giving me the same issue. --66.192.63.2 17:15, 28 October 2009 (UTC)

Problems with post data
Hello,

I followed the directions in this article to create a short url using apache RewriteRules. Everything worked easily, except for the fact that I cannot seem to login to my wiki anymore. Whenever I attempt to login I am presented with the same login form, with my data erased. After digging into the code a little bit, I found that the post data is getting lost somewhere in the redirect. Has anyone else encountered this problem? If so, what steps did you take to overcome it? 66.194.253.20 20:12, 20 February 2007 (UTC)

Couple of questions???
When I am trying the rewrite or the alias methods, What else should be in my .htaccess file besides what I am supposed to be adding? Should I put the .htaccess file in the public_html folder or public_html/w/ which is the folder I have the wiki in? When looking the the localsettings.php I see $wgScriptPath should I change = "/w"; or add the $wgArticlePath = "/wiki/$1"; I seem to be a little lost on this.


 * .htaccess should go in public_html
 * Leave $wgScriptPath alone
 * robchurch | talk 01:57, 21 July 2007 (UTC)

Trailing slash
I have a problem with the rewrite conditions when a page is accessed with a trailing slash. MediaWiki sees it as a different page - (Named Page/ instead of Page). What's the "right" way to get around this? Currently I'm doing a preg_replace on $GLOBALS[_REQUEST]['title'] in my LocalSettings.php, but this seems less than ideal.

~/web_root/.htaccess
Options FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ index.php?title=$1 [L,QSA]

~/web_root/LocalSettings.php
$wgArticlePath = "$wgScriptPath/$1"; $GLOBALS['_REQUEST']['title'] = preg_replace("/^(.+)\/$/", "$1", $GLOBALS['_REQUEST']['title']);

- Trevor Wennblom 21:33, 20 March 2007 (UTC)

Slash "\" in page title breaks the page
http://bugzilla.wikimedia.org/show_bug.cgi?id=9551

Using the short-URL method causes slashes "\" not to work in URLs. This is with Apache 2.2 on Windows 2003 server. Maiden taiwan 18:38, 10 April 2007 (UTC)

Help with Rewrite mode.
I have done the rewrite mode and when i try to enter the website to the index.php without the file name it redirects me to the wiki. What happened?

That rewrite code didn't work for me!!
I had the wiki files installed http://www.domain.ext/hebrew/w/

Instead of having that ugly http://www.domain.ext/hebrew/w/index.php?title=Main_Page

I wanted to forward http://www.domain.ext/hebrew/wiki/Main_Page

The subdirectory business gave me a hell of a headache

After many pints of beer, I managed it with the following code in public_html/.htaccess: RewriteEngine On RewriteBase /hebrew RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^hebrew/wiki/(.*) w/index.php?title=$1 [PT,L,QSA] RewriteRule ^hebrew/wiki/*$ wiki/ [L,QSA] RewriteRule ^/*$ wiki/ [L,QSA] I do hope this helps somebody, so that I didn't yank mi hair for nothing. --89.0.123.140 22:42, 6 May 2007 (UTC)
 * Replace "hebrew" with your subdirectory name.


 * Oh, and I also edited LocalSettings.php for the internal wiki redirection to work:
 * $wgScriptPath = "/hebrew/w";
 * $wgArticlePath = "/hebrew/wiki/$1";
 * Voila. --89.0.123.140 22:50, 6 May 2007 (UTC)

Same problem here. On a Redhat (7)? system running httpd-2.0.40-21 and CGI-PHP, Alias directives didn't pass the variables to the script (no title=Article is a problem). The article says to use: RewriteEngine On RewriteLog /var/log/httpd/rewrites.log # my addition RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*)/wiki/(.*) $1/w/index.php?title=$2 [PT,L,QSA]

but, this only generated File does not exist: &lt;path_to_html&gt;/wiki/Main_Page errors, and rewrites.log remained empty. Adding AllowOverride FileInfo into directory &lt;path_to_html&gt; and using the above .htaccess worked beautifully.

My .htaccess is the following: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/wiki$ RewriteRule ^(.*) /w/index.php?title=Main_Page [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/(.*) w/index.php?title=Main_Page

CSS are not loaded properly anymore after manipulation
Everything is working ok except that the css sheets are not loaded, it seems that I have a problem with the skin...

solution
I think the Alias code given is wrong, and incomplete. The part about /index.php is useless, and you need an alias for skins before the alias for index.php. The following worked for me so far (Alias method, with root access)

Alias /wiki/skins "/path/to/w/skins/" Alias /wiki "/path/to/w/index.php"

extensions
This solution worked for me. I also had a problem where fckeditor failed to show up. I resolved with a similar Alias directive:

Alias /wiki/extensions /path/to/w/extensions/

on Allowing for escaped characters in URI
Is the stuff written there a solution for all escaped characters? I'd need ü,ö,ä,ß,+. Jan

Wiki installed in root on a subdomain.
My wiki is installed in /home/sites/360-fan.net/wiki/ and I use the domain http://wiki.360-fan.net.

What would be the correct settings for me to use if I want http://wiki.360-fan.net/$1?

Please add the answear either here, or send it to birger(underscore)nord (at) hotmail dot com.

Special Pages Fail
After using: RewriteEngine On RewriteCond %{REQUEST_URI} ^/wiki$ RewriteRule ^(.*) /wiki/index.php?title=Main_Page [L] RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/(.*) wiki/index.php?title=$1 [PT,L,QSA] It works but whenever clicking on a special page or template page it fails.. any ideas why?


 * I have the same problem. I am running it on my personal computer using WAMP5 1.7.2 with PHP 5.2.3 and MySQL 5.0.41. 68.173.194.2 00:15, 21 July 2007 (UTC)


 * Same here too, see also my question here.
 * Thanks in Advance
 * best regards
 * TurboKanne, Thursday, February 7th.

Seems that this problem is related to Windows, not Apache or Mediawiki. I found a post on this here, but I'm not sure exactly how to implement the workarounds that author suggests. Can anyone help? –Jonathan Kovaciny 22:18, 26 February 2008 (UTC)

Difficulty with rewrite
Hi all,

Bear with my noobishness. I'm not particularly skilled with servers. On the website I'm helping with, RationalWiki, MediaWiki is installed directly into public_html. The rewrite doesn't seem to work, is that a result of the placement of the files? --Linus M. 16:35, 26 May 2007 (UTC)


 * Arr, I was too lazy to read all of the docs. Never mind. --Linus M. 21:15, 9 June 2007 (UTC)

Small problem
I decided to go ahead and use the subdomains with no subdirectory in article url option, however I end up with a slight problem (and this might be my lack of expertise with a .htaccess). You can access the wiki perfectly if you include in the url /Main_Page (so if you go to http://wiki.example.com/Main_Page, everything is displayed properly). However, if you go to http://wiki.example.com/, you are automatically redirected to http://wiki.example.comhttp//wiki.example.com/Main_Page, which is, you know, weirding me out.

Any suggestions?

[Update]: The issue seems to also include edits and random pages. The edit goes through, but redirection doesn't. I'm still returned to http://wiki.example.comhttp//wiki.example.com/Main_Page.

24.159.57.176 14:56, 28 May 2007 (UTC)

Problem with Lighttpd Rewrite and character "/" in page name
Hello,

I am using "Templates/Languages" to get several language versions displayed in my wiki pages. Creating a site in another language, it is done by "Page_Name/language" (e.g. Main_Page/de).

This - however - results in 404-Error, when using the given Rewrite Code from this manual.

Any hints?

Fixing redirection
I noticed a strange problem whereby any page with title ending in the letter "k" gave a "404 Not found" error upon clicking "Save page" and subsequently whenever trying to access that page (e.g. via search).

The configuration of the MW1.10 installation (PHP5, Apache2, with root at /var/www/</tt>), located at /var/lib/Wiki/</tt>... first, LocalSettings.php</tt>:

$wgSitename        = "WBM";

$wgScriptPath      = "/wiki"; $wgScript          = "$wgScriptPath/index.php"; $wgRedirectScript  = "$wgScriptPath/redirect.php";

$wgArticlePath     = "/wiki/$1";
 * 1) For more information on customizing the URLs please see:
 * 2) http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
 * 3) If using PHP as a CGI module, the ?title= style usually must be used.
 * 1) $wgArticlePath     = "$wgScript/$1";
 * 2) $wgArticlePath     = "$wgScript?title=$1";

next /etc/apache2/conf.d/mediawiki.conf</tt>

Alias /wiki "/var/lib/Wiki"

<Directory /var/lib/Wiki/> SSLRequireSSL Options +FollowSymLinks AllowOverride All order allow,deny allow from all </Directory>

<Directory /var/lib/Wiki/config> Options -FollowSymLinks AllowOverride None </Directory> <Directory /var/lib/Wiki/upload> Options -FollowSymLinks AllowOverride None </Directory>
 * 1) some directories must be protected

Finally, /var/lib/Wiki/.htaccess</tt>:

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*[^wiki/])/?$ /wiki/index.php?title=$1 [QSA,L]

Te problem was taking dodgy advice while not thinking too much about how the rewrite works. I still haven't found a really good explanation of mod_rewrite but the regex ^(.*[^wiki/])/?$</tt> was the likely culprit. This was looking for a string at the start of the URL that did not contain the characters w, i, k and /. On further testing, any page created in the wiki ending with a w, i, or k was causing problems. Removing the "wiki" to just

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*[^/])/?$ /wiki/index.php?title=$1 [QSA,L]

seems to have worked so far. Hoogs 05:29, 11 July 2007 (UTC)

Can IIS display short URLs?
Does anyone know how to configure IIS to display short URLs? The instructions in the article require modifying the .htaccess</tt> file but there isn't such a file in IIS. I'm running IIS 6.0 on Windows Server 2003 R2. --Lorikeet 13:20, 18 July 2007 (UTC)

That is a very good question. I am also running Mediawiki on IIS 6 / Windows 2003 Server and having the same problem : there is no .htaccess in IIS! Is there any solution to use short url with Micrsoft's web server? --stefor


 * Someone has graciously provided us with instructions for doing this. See the new section that's been added to the manual. I'll try it out and let you know how it goes. --Lorikeet 23:06, 2 August 2007 (UTC)

Trying to upgrade from 1.6 but stuck with existing links
Can anyone help - I am using 1.6.8 and have lots of links to the wiki in the style /wiki/index.php/article

On my shared server, PHP5 is only available as CGI. I don't care how ugly the links are, I just need to redirect /wiki/index.php/article to (I presume) /wiki/index.php?title=article

--Apotts 17:49, 30 July 2007 (UTC)
 * I'd try changing your $wgArticlePath to the default in LocalSettings.php, which is:
 * $wgArticlePath = "{$wgScript}?title=$1";</tt>
 * but if that doesn't work, put this in your .htaccess file to do the rewrite you requested:

RewriteEngine On RewriteBase / RewriteRule ^wiki/index\.php/(.*) wiki/index.php?title=$1 [PT,L,QSA]
 * &rarr; Tim Laqua <sup style="font-size: 80%;">Talk | contribs  <sub style="font-size: 80%;">@02:04, 31 July 2007 (UTC)

mod rewrite slash/ampersand problem
What is the way round this? I see that pages on wikipedia.com can have these characters with no problem. 84.64.106.164 21:33, 22 August 2007 (UTC)

PHP as CGI module: solutions & settings
I'm running PHP5 as a CGI module, which means I had to do some complicated things (slightly) to get Short URLs working on my system. I'm also running Wiki on a shared server, which means I don't have root access. Here's what I did to get the Short URLs working properly:


 * Note, everything that says "wikific" replace with your installation's directory. My entire wiki is installed in a subdirectory of my main directory-- in other words, one folder below public_html. This folder also functions as a subdomain, but you don't have to have that feature enabled for this to work. (For reference, my installation is at http://seventh-star.net/wikific)

For your convenience, I bolded all the areas that pertain to my site specifically; these'll be the things you'll change to your directory/site name.

In LocalSettings.php

$wgSitename        = "WikiFic";

$wgScriptPath      = "/wikific"; $wgScript          = "$wgScriptPath/index.php"; $wgArticlePath     = "$wgScriptPath/$1";
 * 1) If using PHP as a CGI module, use the ugly URLs

$wgRedirectScript  = "$wgScriptPath/redirect.php";

$wgStylePath       = "{$wgScriptPath}/skins"; $wgStyleDirectory  = "$IP/skins"; $wgLogo            = "$wgStylePath/common/images/wikific_logo.png";

$wgUploadPath      = "$wgScriptPath/images"; $wgUploadDirectory = "$IP/images";

It's important not to have any paths defined BEFORE the path itself. That is, you shouldn't see $wgScriptPath as a value (after the = sign) BEFORE you see $wgScriptPath = (when it's defined for the first time).

.htaccess:

RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wikific/(.+)$ /wikific/index.php?title=$1 [L,QSA]

I hope this helps some people that were in the same fix as me! I went through several 404s, 500 Server Errors, CSS being mangled... but the above settings fixed everything! --Azurite 06:57, 3 September 2007 (UTC)

All-in-one Search request, Login/logout, trailing slash fix:
Toying around with Rewrite rules, I had various problems that I couldn't seem to resolve all simultaneously:
 * Search requests wouldn't get processed correctly
 * Returning to a page after Login/Logout failed to load the skin
 * Trailing slash

Finally, I was able to get everything to function. I've found this to work with free Ionic ISAPI Rewrite Filter for IIS5.1/6.0; I assume it would work for Apache mod_rewrite as well, as the syntax is the same (if anybody has the same problems, that is)

IsapiRewrite4.ini or .htaccess: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/wiki/.*[?](.*)$ /wiki/index.php?$1 [I,L]
 * 1) Checks for local file existance so that .css, .js and other MediaWiki files aren't processed
 * 2) Replace any non-file, non-directory request before a '?' w/ "index.php"
 * 3) (This is to make the Special:Search?search=... requests work)

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/wiki/([^/]*)\/?$ /wiki/index.php?title=$1 [I,L] The first set of RewriteConds & RewriteRule corrects the somewhat odd syntax for Search request URLs. That final line will kill your trailing slash, should the article request be made with one.
 * 1) Everything else (articles) should fall back to this

And of course LocalSettings.php must still use: $wgScriptPath      = "/wiki"; $wgArticlePath     = "$wgScriptPath/$1";

Problem with http://www.mediawiki.org/wiki/Manual:Short_URL#Rewrite
I tried this, because if I try the "alias"-Type it won't load up the skins. But if I use the Rewrite everything seems to work, BUT if I want to edit, I always get to edit "index.php". Please help

If you find yourself editing a page called "Index.php", try adding this to LocalSettings.php:

$wgUsePathInfo = false;

This behavior seems to be a new feature with v1.11.0

See for more: diff -uN mediawiki-1.10.2/includes/WebRequest.php mediawiki-1.11.0/includes/WebRequest.php

- Trevor Wennblom 02:18, 21 September 2007 (UTC)

Moved from main page
I moved the following from the main page because it appears like this method does not work. (See Note below) If a method is an obvious dud, we should start removing those duds.

{|border=1

Alias
You can set an alias in .htaccess</tt>, so that the server will invisibly replace "wiki" with "w/index.php". This may not work for some server configurations. If you get a "500 error", it probably means alias is not allowed for you.

Note:Alias</tt> is not allowed in .htaccess</tt> files, at least on Apache 2.0. See the Alias Directive documentation.


 * }

This method has alot of information which seems to be irrelevant, and the code is radically different from all of the other methods. If it is an okay method, please create a new page and add this method here: Manual:Short_URL_overview

{|border=1

Alternate Rewrite Solution
This solution was used for (http://www.eroswiki.com) is in ~/eroswiki/wiki. Which is hosted with 1 & 1. This rewrite rule is placed in the .htaccess file in the ~/eroswiki directory, which achieved the short URLs and the redirection I wanted.

In ~/web_root/.htaccess</tt> RewriteEngine On RewriteCond %{HTTP_HOST} ^domain.com RewriteRule ^(.*)$ http://www.domain.com/$1 [r=301,L] RedirectMatch ^/$ http://www.domain.com/wiki RewriteCond %{REQUEST_URI} ^/wiki$ RewriteRule ^(.*)$ /wiki/index.php?title=Main_Page [L]
 * 1) Redirect http://domain.com to http://www.domain.com

RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/(.*)$ wiki/index.php?title=$1 [PT,L,QSA]

In ~/web_root/wiki/LocalSettings.php</tt>


 * }

Because of the problem in the first sentence, I removed this to the talk page.

{|border=1

Two Subdomains with no Subdirectory in Article URL
''Although a neat looking solution, this didn't work for Martin Cleaver using 1.10 - the urls generated failed to save pages.

This approach to shortening article URLs uses two subdomains: one for short article URLs, the other for all other files and "permanent" article URLs. For example, http://wiki.example.com/Article_Title is the url for an article, and http://static.wiki.example.com/wiki/index.php is where the index file is actually located. The trick to doing this is to use directory rewriting, and the 'wgArticlePath' and 'wgScriptPath' variables.


 * 1) Set up your subdomains pointing to two directories such as /var/www/wiki</tt> and /var/www/wikistatic</tt> for http://wiki.example.com/ and http://static.wiki.example.com respectively.
 * 2) Install the wiki files in the /var/www/wikistatic/wiki</tt> directory. (Standard short URL techniques can be used in that directory as well, if required. You could also not use the "wiki" directory, and put the files directly in the subdomain's root directory, removing the "/wiki" and "wiki/" from the <tt>LocalSettings.php</tt> and <tt>index.php</tt> files below.)
 * 3) In the <tt>LocalSettings.php</tt> file, make the changes shown below.
 * 4) In the <tt>/var/www/wiki</tt> directory, place two files, "index.php" and ".htaccess", as shown below.
 * }

Odessaukrain 10:29, 6 October 2007 (UTC)

Successful installation
After attempting for over two years to do make a short URL, and voicing my concern that these instructions are impossible to understand, I finally found instructions that I could understand: Manual:Short_URL/wiki/Page_title_--_PHP_as_a_CGI_module%2C_no_root_access

For those of you having problems, these instructions may help. Odessaukrain 10:32, 6 October 2007 (UTC)

Sections seperated by root access?
I think the sections should maybe be split up into root access and non root access solutions. what does everyone think? Odessaukrain 10:46, 6 October 2007 (UTC)
 * Nevermind, I completely reorganized this page, thanks to User:Rogerhc reorganization.
 * The following I removed from both pages, this one and Manual:Short URL overview:


 * In all the below examples, it is assumed that MediaWiki is installed in the directory located at www.example.com/w/ and that you want to use www.example.com/wiki/Article as an alias for www.example.com/w/index.php?title=Article. It is possible to use an alternative install directory and an alternative alias simply by changing these values ("wiki" and "w") in the examples below. The process is slightly more complicated if you want both to be the same, or if you want the alias to be the root directory ("" instead of "wiki"), but in both cases it is possible with a bit of tweaking (and a few usage restrictions).


 * Note: The original Manual:Short URL has become so complex I cannot clean it up. So I started the below Short URL overview with no how tos on this page but instead separate pages for Short URL solutions, linked below as subpages of Manual:Short URL. Eventually this Manual:Short URL overview may be moved to Manual:Short URL. Welcome to help! :-) --Rogerhc 06:42, 3 September 2007 (UTC)


 * Complex explanation: MediaWiki does not have Short URLs by default because short URLs work with Web server configurations that vary depending on the specific Web server and hosting account being used.


 * My failed simple explation: MediaWiki does not have short webpage addresses normally because short webpage addresses have to work with server instructions that are different and vary from the specific server and hosting account the mediawiki webpage is using.Odessaukrain 00:24, 9 October 2007 (UTC)

Good ol' Al Gore
Don't know much about the guy, but as far as stupid quotes go he doesn't appear to have a huge number attributed to him. This particular one is often misquoted, though -- presumably the unsubtle distinction between create and invent isn't well understood after all. And I guess the joke wouldn't be as funny if you weren't happy to have your interpretation dominate his intent (and isn't that what Internet communication is all about?) while simultaneously misquoting his actual, original statement.

Jedd 02:09, 9 October 2007 (UTC)
 * Yeah it is a misquote. I knew someone would come along soon and remove it. And sure enough, you are that someone. Odessaukrain 23:07, 9 October 2007 (UTC)

Question about Mediawiki Version 1.11 that may help

 * Short URL - Page Edit Problem after Upgrade to 1.11.0

Odessaukrain 22:34, 10 October 2007 (UTC)

Sections separated by OS, web server, etc.
Since many subtleties vary between operating systems, web servers, and even release levels thereof, I'd suggest to have an additional section started: a directory ordered by these, so folks can first select what they actually have, and then find all known solutions for their environment in one small list.

Nonwithstanding, we can keep the extra listing ordered by target URL style.

Of course, both directories will link to the same set of subpages.

--Purodha Blissenbach 08:01, 13 October 2007 (UTC)


 * Okay, it took me a second to understand what you were suggesting. I am not very mediawiki savy.  This page is not edited much, so no one else will do it if you dont. It was refreshing to be able to edit this page for the past week with no other editors involved (quite a change from mediawiki).  Go for it. Odessaukrain 16:31, 13 October 2007 (UTC)

Manual:Short_URL
In case users accidentally start experimenting with their wiki and screw something up I placed this section here. If I have a line wrong (which is quite probable), please correct it.

Also I cannot remember the default value for .htaccess, if anyone knows it please put it in. -PatPeter,  MediaWiki Support Team  05:22, 23 January 2008 (UTC)

Error reports
I just made a number of subsubpages discussion pages where error reports will be taken for those whose wikis could not get this to work. -PatPeter,  MediaWiki Support Team  00:48, 1 February 2008 (UTC)

Short URLs work fine - except for actions.
Hi,

I am using mediaWiki 1.12.0 and IIS6 as Server. It is installed in the Webdirectory-path "/w/". I wanted to do prettyURLs / ShortURLs, so I changed the following:

LocalSettings.php: $wgArticlePath = '/wiki/$1'; # Virtual path. This directory MUST be different from the one used in $wgScriptPath
 * 1) shorturl support
 * 1) $wgUsePathInfo = true;      # this is outcommented, because IIS uses CGI

and installed Ionic IsapiRewriter 1.2.12c with the following config in the IsapiRewrite.ini: RewriteLog c:\temp\iirfLog.out RewriteLogLevel 3 MaxMatchCount 1 RewriteEngine On

RewriteCond %{HTTP_HOST} ^de.myWiki.org  # This is of course adjusted to my wiki-site :)
 * 1) Change to suit your domain

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
 * 1) Checks for local file existance so that .css, .js and other MediaWiki files aren't processed

RewriteRule ^/wiki/(.*)$ /w/index.php?title=$1 [I,L] RewriteRule ^/wiki/Special:Search(.*)$ /w/index.php$1 [I,L] RewriteRule ^/wiki/Spezial:Suche(.*)$ /w/index.php$1 [I,L]

IterationLimit 4

The prettification works well - except for the action-links and red non-existing-article-links (which are in fact edit-action-links). They are still shown as "http://de.myWiki.org/w/index.php?title=Hauptseite&action=edit" - which I think is incorrect.

Can someone tell me what setting I forgot or what I did wrong?

Thanks a lot! --Thekryz 06:29, 27 May 2008 (UTC)

--82.179.222.150 10:44, 9 June 2008 (UTC)
 * Action links shouldn't be pretty: they're not here, nor are they on Wikipedia. Bots can be told not to trawl the non-pretty area and you wouldn't want a bot to hit the edit page would you?
 * BTW, thanks for providing info about how you've done this on IIS. My boss wants a wiki installed on a Windows Server and if I can do it without installing WAMP so much the better :) --Kingboyk 12:03, 9 June 2008 (UTC)
 * That works a treat mate, thanks very much. Version d of the rewriter was crashing for me, but c is fine (in a VM at least, installing onto the live server now). I'll try to rewrite the Windows instructions later (they're a mess and a bit out of date) and incorporate this into it. Cheers. --Kingboyk 09:25, 10 June 2008 (UTC)

Suggested feature... automatic customized ShortURL Code
There may be a better place to put this on the site (suggestions). Wikiblog has a feature (it is detailed near the bottom of the page). Basically, in the control panel, the software will customize what you should put in the .htaccess file in order to give you short urls. Perhaps something like this can be integrated into Mediawiki somehow. --Emesee 01:55, 29 May 2008 (UTC)

Sin index.php
<DIV align="right">Eloy 23:03, 5 June 2008 (UTC)</DIV>

Short URL "Pretty URL"
I would like to say GOOD JOB, on the documentation. I have my wiki hosted on a 1AND1 server and was having problems with getting the pretty url's to work, since most 1AND1 accounts do not have Root Access. Just a thought but you may want to have a section just for those hosting companies like 1AND1 that do not open up access to the root, for security purposes.

Help configuring the short URLs
Hello all. I've been trying for quite some time to use the short URL methods described - to no avail. I've tried every one at least once, yet nothing works.

I have MediaWiki version 1.12 (the newest release). It is all done on my home computer (just a fun project for now), and I am using MAMP on my Macintosh computer. I have full privileges to everything.

The current URL reads like so: http://localhost:8888/w/index.php/Article (where "Article" is the name of the page). The wiki is installed in the directory <tt>/Omega/Sites/w/</tt>, and MAMP's Apache is being told that the default directory is <tt>/Omega/Sites/</tt>. <tt>LocalSettings.php</tt> is located at <tt>/Omega/Sites/w/LocalSettings.php</tt>.

My current <tt>LocalSettings.php</tt> configurations regarding scripts and articles are like so: $wgScriptPath      = "/w"; $wgScriptExtension = ".php"; $wgArticlePath     = "$wgScriptPath/index.php/$1";

I currently do not have text in <tt>httpd.conf</tt> or <tt>.htaccess</tt>.

I'm willing to try anything (nothing bad will happen - I have plenty of backups to work with, plus it's all on my home computer), but could somebody please help me?

Also, as a quick note, I think that all of the documents on the page should specify where MediaWiki is installed - some of them seem to assume that they're in <tt>/w</tt>, while others assume other things. Makes for some pretty confusing tutorials for someone who doesn't use Apache, MySQL, or PHP for anything except this, and who only started a few weeks ago.

Thanks for any help! ~Signed &Omega;mega234 &Dagger; talk to me

What's with all the "hate" for example.com/Page_title ?
I've been successfully running a Wiki with the abovementioned URL scheme with no problems for some time now, and I don't understand what's with all the deterrent warnings about it. I think that this minimialistic URL scheme is amazing - it looks natural, it excludes pointless elements, it's trivial to remember, and it works. I think that the warning tags are borderline on misinformation, for the following reasons:

1) The only "page titles" that are made unusable are: If you have a wiki about web design, the first two might be a problem.
 * Robots.txt
 * Favicon.ico
 * titles beginning with "Images/"
 * titles beginning with "Skins/"

2) How does this create an "unstable URL structure"? Why does this require thought before diving "willy-nilly"? The only scenario I can think of where it could "destabilize" the URL structure is if the MediaWiki developers add a new file or directory that must be accessible, but can anyone see the odds of the name of this file or directory coinciding with the name of a page title on some wiki somewhere - and even so, this being a big problem that "destabilizes the URL structure"? :-O

Note: I'm OK with Manual:Wiki in site root directory, except that the above issues should be covered and explained in more detail. I'm talking about the template. --78.24.52.142 16:25, 21 September 2008 (UTC)

URL shortening doesn't actually work
Posted 21 October, 2008

It "works" in so far as it shortens the url, but any interface/UI links are still using the technical link format (e.g. site.com/w/index.php?title=something&value=something) rather than a clean link like wikipedia uses (e.g. wikipedia.org/wiki/pagetitle). This will simply cause confusion with people as to what a link should really be, and it's just sloppy.

What's the proper way to structure or modify the wiki source code so that

1. index.php does not exist at all

or

2. the actual links in the UI and on the page are shortened appropriately?

In otherwords, how does wikipedia do it?


 * Response:
 * Shortening does work properly (just like Wikipedia) if set up properly per the appropriate recipe -- see Navas Wireless Wiki, set up with the Manual:Short URL/wiki/Page title -- GoDaddy Shared Linux Subdomain recipe -- so you probably messed up when trying to set it up, but I can't even hazard a guess as to what you did wrong since you've not provided any details. ;)
 * --John Navas 17:50, 21 October 2008 (UTC)
 * p.s. Please note the warning in bold face at the top of this page.
 * p.p.s. Please sign any/all additions you make to the Wiki. Thanks.


 * Short URL will not work for things like page histories, diffs, edit view, preview view, etc. I cannot foresee short URLs ever working for those kinds of pages.--Matt 19:19, 21 October 2008 (UTC)


 * Well duh -- those things don't work on Wikipedia either. ;)
 * --John Navas 19:35, 21 October 2008 (UTC)

Yeah, but that kind of page was in the given example. I was just clarifying.--Matt 19:41, 21 October 2008 (UTC)


 * RE: John Navas
 * I've managed to fix it, there was a random conflict in our .htaccess that was causing the issue, but now we have another conflict that prevents us from fixing the trailing / problem. We have a line that will add a trailing slash to specific parts of the site in order for them to work, and apparently it's doing it to the wiki as well.


 * Thus Manual:Short URL/Ignoring the Trailing slash isn't a solution we can use. Specifically the RewriteRule ^(.+)$ index.php?title=$1 [L,QSA] line. Any advice?


 * EDIT, btw lines in our htaccess that could be affecting this are these:

RewriteCond %{REQUEST_URI} !/$ RewriteCond %{REQUEST_URI} !\. RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
 * 1) Make sure any link going to a portal has a trailing slash


 * Again, this is for something outside of the wiki, but seems to be affecting the wiki. Any advice on how to make the wiki an exception to this would be appreciated :)
 * Also, we are using the folder structure as recommended in this manual. Our scripts are in /w/ and we're using /wiki/ as the virtual directory.


 * As per my p.s. back in the beginning: "It is better to go to MediaWiki_on_IRC where there are live people 24/7, and ask your question there." And please sign your posts here. Thank you. --John Navas 20:36, 21 October 2008 (UTC)

Short Home page URL, not example.com/Main_page

 * I have short URLs working with MediaWiki 1.13.2. Does anyone know who to change the one exception:
 * the Home page which shows
 * the Home page should show

--84.9.191.165 13:58, 1 December 2008 (UTC)

way too complicated
As a manual, the page is way too complicated and difficult to follow.

Here's what I had to do to get it working. It requires that you can put a .htaccess into the wiki root:

add .htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/(.*)$ ./index.php?title=$1 [PT,L,QSA]

then change in LocalSettings.php: $wgArticlePath = "/wiki/$1";

And that's it. How can you write 5 pages about something as simple as that?


 * Because what works is different from server to server; it's like asking, "How can you write 5 pages about getting a girlfriend, I just followed these three steps?" — Pathoschild 07:30:37, 09 February 2009 (UTC)

MediaWiki 1.14 the latest wiki.
I did this method on the latest MediaWiki. When unregistered or registered newbie clicks on a link that is not edited it redirects to some random page called megaclick. How do I resolve that.


 * MediaWiki - 1.14.0
 * PHP - 5.2.8 (cgi-fcgi)
 * MySQL -	5.0.32-Debian_7etch8-log

This is an example: http://www.tamileelamonline.com/en/index.php?title=Talk:Tamil_Eelam_Articles&action=edit&redlink=1 of redirection

Sachein 08:31, 26 March 2009 (UTC)

Does not describe enough
Im having trouble understanding the following. Maybe make it more clear?

"4.Edit httpd.conf to contain the rule Alias /wiki /path/to/your/wiki/index.php. Note that the second path is relative to the filesystem root, not the web root! This might be, for instance, Alias /wiki /var/www/w/index.php, if /var/www/ is your web root. This ALIAS configuration is a minimum configuration, see Apache configuration for further options.If you're using Apache 2, the configuration file is called apache2.conf."

Problem with installation of MediaWiki with Wordpress MU
Too many manual about Short URL confused me too much. None of those instruction let me get the job done to create short URL of Wiki pages. RewriteEngine On RewriteBase / RewriteRule ^(.*/)?files/$ index.php [L] RewriteCond %{REQUEST_URI} !.*wp-content/plugins.* RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L] RewriteCond %{REQUEST_URI} ^.*/wp-admin$ RewriteRule ^(.+)$ $1/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule. - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule. index.php [L] <IfModule mod_security.c> <Files async-upload.php> SecFilterEngine Off SecFilterScanPOST Off </Files> </IfModule> RewriteRule ^wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA] RewriteRule ^wiki/*$ /w/index.php [L,QSA] Please give some advices and explain the purpose of each line (because I can't understand much how to use RewriteRule or RewriteCond)
 * First, I installed Wordpress MU. It created its own .htaccess as shown below:
 * 1) uploaded files
 * 1) add a trailing slash to /wp-admin
 * Next, after installation of Wikimedia,small change to LocalSetting.php, and .htaccess; whe wiki page shows ERROR 404 by adding the following code at the bottom of .htaccess
 * 1) RewriteRule for Wiki

Help configuring the short URLs ||
Hi,

my website is http://www.italien.ch

i'd like that 3 different URLs for the article:


 * http://www.italien.ch/de/Sandbox   (main path)
 * http://www.italien.ch/wiki/Sandbox
 * http://www.italien.ch/de/wiki/Sandbox

How do I that?

thanks

URL with the action in the path
I'm kinda surprised to not see the scheme that we are using the Toolserver. Our URLs are in the form  with action the same as , so articles are   and their edit page is. It abstracts more of what's going behind. --Dispenser 05:19, 3 January 2010 (UTC)

.htaccess file for Apache that always works
Options FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/(.*)$ ./index.php?title=$1 [PT,L,QSA] </IfModule>
 * This is all you need in a .htaccess file (apache) for short urls to work, people tend to forget the Important Option : FollowSymLinks

Cheers! anuga@anuga.se (01/09/2010)

Title Issues?

 * How do I get this:


 * $wgScriptPath = "/wiki";
 * $wgScriptExtension = ".php";
 * $wgUsePathInfo = # Enable use of pretty URLs


 * ( strpos( php_sapi_name, 'cgi' ) === true ) &&
 * ( strpos( php_sapi_name, 'apache2filter' ) === false ) &&
 * ( strpos( php_sapi_name, 'isapi' ) === false );


 * To show this:


 * wiki/Page_title


 * Right now its showing his:


 * wiki/index.php?title=Main_Page

Difference between script and article URL
I apologize if this is here already.

So i converted one of my wiki's over to shorter url's today, and realized that some of the action links at the top of the page still used the physical address, rather than the article address. Is this intention? if it is, is their justification for a small misdeminor against site consitiney ;D. if not, is it worth reporting? Bud0011 22:51, 3 April 2010 (UTC)

Wikipedia's 404 page
If you go to, say, http://en.wikipedia.org/Bash, you'll get this:

How do I get my wiki to do that? Is there a PHP file that will implement this? I have my wiki in /w/ folder, aliased to /wiki/ E.g., http://libertapedia.org/wiki/Bash will work, but not http://libertapedia.org/Bash. I want the latter to give a screen similar to what Wikipedia has, redirecting to the former. Thanks, Tisane 21:52, 6 April 2010 (UTC)
 * This bug looks intriguing... Tisane 01:03, 7 April 2010 (UTC)

Short URL messes up mobile browsing?
I am running MediaWiki 1.16beta, and people are reporting that my wiki is not working on handheld devices. They say:

libertapedia.org is, for mobile phones, redirecting to en.m.wikipedia.org (which is for mobile phones). Looks like somebody installed something wrong, maybe this was some extension? Or the default is to redirect to the mobile Wikipedia page. All I know is that I get libertapedia pages fine on my regular computer, but get, on my iPhone, a corresponding mobile wikipedia page for any libertapedia page I try to access, if it exists on Wikipedia. Such as your user page on Wikipedia, or the home page. Otherwise I get the same thing as if I ask for a non-existent page on Wikipedia. I can't see libertapedia on the iPhone, even if I try to "disable mobile access" on the Wikipedia page. The redirection must be happening on libertapedia, when it sees that the access computer is a mobile phone. There might be a way to defeat it with special code in the URL.

I said, iPhone, the standard browser for it, Safari. I'm using Firefox now, but that's not relevant. No problem with Firefox, but I don't believe that the browser is the issue. It's the mobile phone. Here is what I think is happening. I think that this wiki detects that a phone is accessing it and redirects to the mobile phone version of the site. There isn't one, of course, but one exists for wikipedia: en.m.wikipedia.org, and I'd guess that's set as a default. Unless you want the crippled mobile phone interface like there is on Wikipedia, turn it off. Or make sure it points to your mobile phone interface instead of the wikipedia one.

You should also be aware that Verizon uses are having problems with your site. According to Verizon, "Suspected Fraudulent Web Site Detected by the Verizon Internet Security Suite Fraud Protection" is an apt description of every single page on your site. The user has to click "continue to web site" each time she attempts to access a different page.

The wiki is stored in the /w/ folder, and my htaccess settings are as follows: AddHandler application/x-httpd-php5s .php RewriteEngine on RewriteCond %{HTTP_HOST} ^(www.)?rped.org$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA] RewriteRule ^wiki/*$ /w/index.php [L,QSA] RewriteRule ^/*$ /w/index.php [L,QSA] RewriteRule ^libertapedia/wiki/(.*)$ libertapedia/w/index.php?title=$1 [PT,L,QSA] RewriteRule ^libertapedia/wiki/*$ libertapedia/w/index.php [L,QSA] RewriteRule ^libertapedia/*$ libertapedia/w/index.php [L,QSA]

Also, compare the behavior of these links:
 * http://libertapedia.org/w/index.php?title=Libertapedia&handheld=yes
 * http://libertapedia.org/wiki/Libertapedia&handheld=yes

A list of installed extensions is available here. Any insight into what might be the issue? Thanks, Tisane 19:49, 11 April 2010 (UTC)