Manual talk:Short URL/Old discussion page

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

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)

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"

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)

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)