Manual talk:Short URL/Old discussion page

Latest comment: 11 years ago by 38.99.141.190 in topic 1&1 Hosting

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)Reply

To-do list
  • HOUSE KEEPING Begin removing nonworking short URL solution links from the main page to the talk page until someone speaks up and says these nonworking Short URL solution links actually work
  • WRITING Using the best portions of the main page as inspiration, begin writing a comprensive and easy to understand manual on how to create a short webpage addess [url].

Hard To Understand? edit

Read Manual:Short URL/wiki/Page title -- no root access cpanel

Short URLs for MediaWiki on a subdomain, where wiki is several directories down edit

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 edit

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 edit

please please finish this somebody

This article is getting too long -- please use subpages edit

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)Reply

Which is better? edit

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 edit

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 edit

I have gotten Mediawiki Pretty URLs to work here at [1] 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

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

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


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

Change in LocalSettings:

$wgArticlePath      = "$wgScriptPath/$1";

Rewrite Okay, recognition not edit

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)Reply

Excactly the same Problem. --87.123.135.136 22:04, 19 February 2007 (UTC)Reply

I have the same probleme--86.193.126.194 00:25, 15 April 2007 (UTC)Reply
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)Reply

Problems with post data edit

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)Reply


Hi, I know this is years later... but I'd like to share what worked for me. 1. The .htaccess

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

This is nothing new. Pretty much the same code I was seeing every where else. But, here was the tricky part; here is what I had to add to my LocalSettings.php file:

   $pageURL = 'http';
   if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
   $pageURL .= "://";
   if ($_SERVER["SERVER_PORT"] != "80") {
       $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
   } else {
       $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
   } // Getting the page url
   if (strpos($pageURL,'returnto') !== false) {  // If the page url contains the string 'returnto' (used on login/logout pages), do nothing.
       return;
   }else{  // If the page url does not contain the string 'returnto', continue with the rewrite.
       $wgScript = "";
       $wgArticlePath = "$wgScript/wiki/$1";  
   }

Basically, this runs a check to see if the page contains the string 'returnto'. This string is used on the login/logout pages. If the url contains this string, we are NOT going to modify the short url change (leaving login/logout intact). If the string is not found in the url, the rewrite will continue as normal.

Hope this helps someone in the same boat I've been in for the past few nights!

Couple of questions??? edit

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.

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

Trailing slash edit

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 edit
Options FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?title=$1 [L,QSA]
~/web_root/LocalSettings.php edit
$wgArticlePath = "$wgScriptPath/$1";
$GLOBALS['_REQUEST']['title'] = preg_replace("/^(.+)\/$/", "$1", $GLOBALS['_REQUEST']['title']);

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

Slash "\" in page title breaks the page edit

bugzilla:9551

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

Help with Rewrite mode. edit

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!! edit

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]
  • Replace "hebrew" with your subdirectory name.

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)Reply

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)Reply
Finally found one that works!

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: <path_to_html>/wiki/Main_Page errors, and rewrites.log remained empty. Adding AllowOverride FileInfo into directory <path_to_html> 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 edit

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

solution edit

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 edit

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 edit

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

Wiki installed in root on a subdomain. edit

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 edit

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)Reply
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)Reply

Difficulty with rewrite edit

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)Reply

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

Small problem edit

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)Reply

Problem with Lighttpd Rewrite and character "/" in page name edit

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 edit

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/), located at /var/lib/Wiki/... first, LocalSettings.php:

$wgSitename         = "WBM";

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

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

next /etc/apache2/conf.d/mediawiki.conf

Alias /wiki "/var/lib/Wiki"

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

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

Finally, /var/lib/Wiki/.htaccess:

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/])/?$ 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)Reply

Can IIS display short URLs? edit

Does anyone know how to configure IIS to display short URLs? The instructions in the article require modifying the .htaccess 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)Reply

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)Reply

Trying to upgrade from 1.6 but stuck with existing links edit

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)Reply

I'd try changing your $wgArticlePath to the default in LocalSettings.php, which is:
$wgArticlePath = "{$wgScript}?title=$1";
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]
Tim LaquaTalk | contribs@02:04, 31 July 2007 (UTC)Reply

mod rewrite slash/ampersand problem edit

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)Reply

PHP as CGI module: solutions & settings edit

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";

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


$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)Reply

All-in-one Search request, Login/logout, trailing slash fix: edit

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:

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

# Everything else (articles) should fall back to this
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.

And of course LocalSettings.php must still use:

$wgScriptPath       = "/wiki";
$wgArticlePath      = "$wgScriptPath/$1";

Problem with Manual:Short URL#Rewrite edit

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)Reply

Moved from main page edit

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.

Alias edit

You can set an alias in .htaccess, 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.

1. Edit or create .htaccess in public_html with the following content. 'wiki' is what users will see; 'w/index.php' is what it will load.
Alias wiki w/index.php
2. Add or edit the following setting in LocalSettings.php. This causes the HTML generated by MediaWiki to refer to "/wiki/Articlename" instead of the default.
$wgArticlePath = "/wiki/$1";

Note:Alias is not allowed in .htaccess 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#Short_URL_how_tos

Alternate Rewrite Solution edit

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

RewriteEngine On
#Redirect http://domain.com to http://www.domain.com
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]

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

$wgServer = "http://www.domain.com";
$wgArticlePath = "/wiki/$1";

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

Two Subdomains with no Subdirectory in Article URL edit

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 and /var/www/wikistatic for http://wiki.example.com/ and http://static.wiki.example.com respectively.
  2. Install the wiki files in the /var/www/wikistatic/wiki 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 LocalSettings.php and index.php files below.)
  3. In the LocalSettings.php file, make the changes shown below.
  4. In the /var/www/wiki directory, place two files, "index.php" and ".htaccess", as shown below.


Odessaukrain 10:29, 6 October 2007 (UTC)Reply

Successful installation edit

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,_no_root_access

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

Sections seperated by root access? edit

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)Reply

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)Reply
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)Reply

Good ol' Al Gore edit

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)Reply

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)Reply

Question about Mediawiki Version 1.11 that may help edit

Odessaukrain 22:34, 10 October 2007 (UTC)Reply

Sections separated by OS, web server, etc. edit

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)Reply

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)Reply

Manual:Short_URL#Reversion edit

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)Reply

Error reports edit

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)Reply

Short URLs work fine - except for actions. edit

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:

#shorturl support
$wgArticlePath = '/wiki/$1';  # Virtual path. This directory MUST be different from the one used in $wgScriptPath
#$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

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

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

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)Reply

--82.179.222.150 10:44, 9 June 2008 (UTC)Reply

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)Reply
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)Reply

Suggested feature... automatic customized ShortURL Code edit

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)Reply

Sin index.php edit

Español: El siguiente código, agregado a .htaccess, redirige index.php a la URL corta. Sólo lo hace si no tiene otro parámetro (como action=edit).
English: The following code, added to .htaccess, redirects index.php to short URL. Only works if there's no other parameter (like action=edit).

RewriteRule ^w/index\.php[?]title=(.*)$ http://www.dominio.com/wiki/$1 [R=301,L]

Short URL "Pretty URL" edit

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 edit

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 /Omega/Sites/w/, and MAMP's Apache is being told that the default directory is /Omega/Sites/. LocalSettings.php is located at /Omega/Sites/w/LocalSettings.php.

My current LocalSettings.php configurations regarding scripts and articles are like so:

$wgScriptPath       = "/w";
$wgScriptExtension  = ".php";
$wgArticlePath      = "$wgScriptPath/index.php/$1";

I currently do not have text in httpd.conf or .htaccess.

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 /w, 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 Ωmega234talk to me

What's with all the "hate" for example.com/Page_title ? edit

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:

  • Robots.txt
  • Favicon.ico
  • titles beginning with "Images/"
  • titles beginning with "Skins/"

If you have a wiki about web design, the first two might be a problem.

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 {{wiki-in-docroot}} template. --78.24.52.142 16:25, 21 September 2008 (UTC)Reply

URL shortening doesn't actually work edit

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)Reply
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)Reply
Well duh -- those things don't work on Wikipedia either. ;)
--John Navas 19:35, 21 October 2008 (UTC)Reply

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

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:
#Make sure any link going to a portal has a trailing slash
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]
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)Reply

Short Home page URL, not example.com/Main_page edit

  • I have short URLs working with MediaWiki 1.13.2. Does anyone know who to change the one exception:
  • the Home page which shows www.example.com/Main_page
  • the Home page should show www.example.com

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

way too complicated edit

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)


I used this method and it works, but the search defaults to the long urls. If I retype the article urls the short urls work. How do I get mediawiki to default to using short urls when searching. Or better yet hide the long urls code gunk altogether and only display the short urls. Thank you 24.130.249.87 00:05, 20 June 2012 (UTC)Reply

MediaWiki 1.14 the latest wiki. edit

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)Reply

Does not describe enough edit

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 edit

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.

  • First, I installed Wordpress MU. It created its own .htaccess as shown below:
RewriteEngine On

RewriteBase /

#uploaded files
RewriteRule ^(.*/)?files/$ index.php [L]
RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L]

# add a trailing slash to /wp-admin
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>

  • 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
# RewriteRule for Wiki
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)

Help configuring the short URLs || edit

Hi,

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

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

How do I that?

thanks


URL with the action in the path edit

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

.htaccess file for Apache that always works edit

  • This is all you need in a .htaccess file (apache) for short urls to work, people tend to forget the Important Option : FollowSymLinks
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>

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

Title Issues? edit

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 edit

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)Reply

Wikipedia's 404 page edit

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

<html>
<head>
<title>
Wikimedia page not found: http://en.wikipedia.org/Bash
</title>
<link rel="shortcut icon" href="/favicon.ico" />
<meta http-equiv="Refresh" content="5; URL=http://en.wikipedia.org/wiki/Bash">
</head>
<body>
<h1><a href="http://en.wikipedia.org/wiki/404_error">404 error</a>: File not found</h1>
The <a href="http://en.wikipedia.org/wiki/Uniform_resource_locator">URL</a>
you requested was not found.

<p><b>Did you mean to type <a href="http://en.wikipedia.org/wiki/Bash">http://en.wikipedia.org/wiki/Bash</a>?</b>

You will be automatically redirected there in five seconds.</p>

<p> Maybe you would like to look at:
<P>
<UL><LI><a href="/">The main page</A>
    <li><a href="http://download.wikimedia.org">The list of Wikimedia downloads</A>
</UL>
<P>
<hr noshade/>
<p><i>A project of the <a href="http://wikimediafoundation.org/">Wikimedia
foundation</a></i>.</p>

</body>
</html>

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)Reply

This bug looks intriguing... Tisane 01:03, 7 April 2010 (UTC)Reply

Short URL messes up mobile browsing? edit

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:

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

1&1 Hosting edit

Anyone can be write how to configure Short URL on 1and1 hosting? Solution from 2007 yr (find on Internet) doesn't work.

1&1 Solution edit

This is what I currently have setup on my 1&1 hosting. It's essentially an amalgamation of trial and error of some of the options here on this manual.

Note - This is for yourdomain.com/article, not yourdomain.com/wiki/article.

In, LocalSettings.php,

$wgScriptPath       = "";
$wgScriptExtension  = ".php";
$wgArticlePath      = "/$1";
$wgUsePathInfo      = false;

And in, .htaccess

RewriteEngine On
RewriteRule ^[^:]*\. - [L]
RewriteRule ^[^:]*\/ - [L]
RewriteRule ^/*$ /index.php?title=Main_Page [L,QSA]
RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]

It isn't without it's problems however. It works flawlessly for articles and article/subpages, the exception being for if you go article/subpage/subpage. Editing the article/subpage/subpage is possible if you edit the url in your address bar to get to the edit page, but you cannot view the page at all outside of edit/move/history/etc. I'm looking for a way to fix this, but I haven't been able to find anything yet.

Anshinritsumai 02:30, 8 September 2011 (UTC)Reply

You know you need the ? before the handheld=yes, right?38.99.141.190 14:23, 18 March 2013 (UTC)Reply

+ symbol redirects in titles edit

When we use the + in titles it gets removed altogether. I tried to post an article titled C++ and it gets changed to C. I think this might have something to do with short urls but I have no idea what.

Example: http://en.wikiaudio.org/Article++

Thanks in advance67.59.193.62 23:39, 22 April 2011 (UTC)Reply

Separate paths for different namespaces edit

Has anyone successfully hacked MediaWiki to provide different urls for different namespaces? I.e Plant:Tree => www.example.com/plant/tree and Animal:Tiger => www.example.com/animal/tiger 213.89.121.199 19:43, 20 May 2011 (UTC)Reply

Short Url on Search Engines? edit

Why Search Engines doesn't crawl my short url pages: my web: http://www.howiw.com

"Revert to default"-path edit

Shouldn't the $wgScriptPath in the "Revert to default" example read /w/ (as in the Setup steps on top ) and not /wiki/?

Instructions missing? edit

What happened to the page entitled Manual:Short URL/wiki/Page title -- no root access cpanel? That was really useful. Modrobene (talk) 15:04, 25 March 2012 (UTC)Reply

Gadget-popups edit

When using pretty Short URL's my Gadget-popups works not properly.

All links pop up with an unproper slash '/' making a wrong link.

How do i fix the problem?

--Ribe (talk) 08:47, 9 April 2012 (UTC)Reply

fullurl doesn't use $wgArticlePath edit

fullurl creates real path, but shouldn't it use the alias path ass et in $wgArticlePath? If it's not intended i'd open a request on bugzilla.

Rewrite of page edit

I'm going to be doing a total redo of this page because I've found it to be too confusing and never been able to successfully make short URL based on the information here. However, the information on the same topic at the Dreamhost wiki has been extremely simple, and I have always been able to make a short URL on the first attempt. I plan to copy and attribute the content from that wiki into this article, since it is far easier for less advanced users to use. Инкуиситор Саша Ехренстеин аус дем Стурмкриг Сектор (Talk) (Contributions) 01:49, 9 July 2012 (UTC)Reply

I can just agree with your statement. I always use the same simple code, either in .htaccess or in httpd.conf. Let's try it! Tim (SVG) 07:10, 9 July 2012 (UTC)Reply
Your rewrite was too simplistic. It doesn't cover enough use cases. I think it worked for you, but not for me. I had to dig in the original version of the page to find what I needed. Please restore the original content. JordiGH (talk) 14:29, 26 July 2012 (UTC)Reply
For the moment, I've added a message at the top of the page mentioning the old version. Tim (SVG) 09:41, 28 July 2012 (UTC)Reply
I start writing a new set of shorturl manuals and a tool all with proper practice. And then our manual page gets completely replaced by junk from DreamHost talking about DreamHost and promoting the bad practice I've been trying to get rid of? Unacceptable. Daniel Friesen (Dantman) (talk) 05:11, 31 July 2012 (UTC)Reply
I tried using all the variations on the old version, even with the rewrite; none of them worked. It was too complicated, assumed too much, and was too problematic. I never got a single short URL working from it. The Dreamhost manual though, I've been able to get working every time with different setups, methods, and webhosts. I copied and attributed the successful manual for ease of use for less experienced users. I realize maybe it wasn't comprehensive enough, but it wasn't nearly as confusing as what was before it.
The only mention of Dreamhost (besides the legally required attribution) was a section on how to prevent it from interfering with website statistics pages or something that Dreamhost provides.
What exactly is the bad practice that it was promoting?
I'll include it as a section toward the bottom for new users if there are no objections.
Инкуиситор Саша Ехренстеин аус дем Стурмкриг Сектор (Talk) (Contributions) 04:32, 3 August 2012 (UTC)Reply
Take a good look at the text: Manual:Short_URL?oldid=566360
The very first line opens up as "This Short URL help page describes how to configure Dreamhost-hosted MediaWiki installs to [...]".
  • Additionally it has absolutely no documentation for anything but Apache.
  • No guide on how to use Alias in server configuration (the recommended way to set it up if you can)
  • No information on how to set up anything but /wiki/$1 is given. Neither is any information on how to forward the root / url to the wiki.
  • The instructions given will also break on some Apache setups. As some of them require a ^/wiki/ rather than ^wiki/.
  • It also assumes that you're not using mod_php and setting $wgUsePathInfo is needed. (Btw, as of 1.20 that won't be necessary)
The bad practice is the inclusion of ?title=$1 in the url. This practice breaks & and + in your urls and overrides MediaWiki's good built-in url routing with broken url handling.
Daniel Friesen (Dantman) (talk) 05:23, 3 August 2012 (UTC)Reply

Redirect from /Main_Page edit

i'm trying to make redirect/rewrite .htaccess file with settings from http://domain.com/Main_Page to just address http://domain.com/ . Any have ideas about it ? — Preceding unsigned comment added by 95.25.165.65 (talkcontribs) 17:06, 30 September 2012‎

At the moment we do not support that. We also need to fix our rel=canonical handling before we even think of doing that. Daniel Friesen (Dantman) (talk) 17:08, 30 September 2012 (UTC)Reply
Return to "Short URL/Old discussion page" page.