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

Possible Syntax Error
There appears to be a syntax error in the instructions to setup the .htaccess file.

There are 3 references to a path w/index.php?title but the rest of the document refers to wiki/ being the base path.

Chaning the instances of w/ to wiki/ should get it working. --Paul D. 72.243.145.70 05:27, 15 October 2007 (UTC)

Proposed Syntax Change
Rather than refer to wiki/ as being the directory, it might be better to use  wiki_path / with a callout that wiki_path is the location under public_html (or www) of your installation. --Paul D. 72.243.145.70 05:27, 15 October 2007 (UTC)


 * I think it should be  --Alvin-cs 12:50, 10 November 2007 (UTC)

This solution partially worked for me
I've got Apache2Triad installed with mediawiki in a htdocs/wiki directory. I had to take the basename code out as recommended and the wiki loads up, I can edit mainspace articles, but user:space, Special:space template:space doesn't seem to be operating - any ideas? en:user:joopercoopers--81.77.220.89 03:04, 3 November 2007 (UTC)

Worked, but a problem
I had to changed index.php to php5 since on our host. That solved the issue, but we have a bigger problem - we have a forum installion within our public_html folder - thus, any links going directing to our .com are instead returning a 500 error.

Is there anyway to do the htaccess file WITHIN the wiki folder? --71.177.82.149 07:32, 1 December 2007 (UTC)

Had to change a few things
Here's how my changed htaccess looks.

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/(.*)$ w/index.php5?title=$1 [PT,L,QSA] - Added the 5 to .php RewriteRule ^wiki/*$ w/ [L,QSA] - Changed the second wiki/ with w/

This allows me to run it on the /wiki directory while having a forum in the main directory. --Mephisteus 17:36, 8 March 2008 (UTC)

Clear browser cache.
You may need to clear your browser's cache before changes will take effect.

Not working
I still cannot get this to work. I've tried having my wiki in both a "w" directory, as well as a "wiki" directory. All I'm getting are 500 error messages. .htaccess is enabled on my site, as I regularly change URLs and such. I've really got no idea where the problem is coming from.
 * Hey,maybe you should read the apache log file to find out reason--Pmq20 09:54, 19 July 2008 (UTC)

How to get this to work
I've got my wiki installed on wiki.example.com and it's in the root dir for this subdomain. How can I get this to work?
 * Okay got it, it's very easy and you only have to remove a few things. Enjoy!

Root Access
Doesn't having to mess with followSymLinks and "AllowOverride None" defeat the purpose of this tutorial being made for people with no root access?
 * The article mentions AllowOverride None at the end so that people whose .htaccess files aren't working will know what to ask their hosts. Being able to ask your host to change a setting is not the same thing as having root access. —Emufarmers(T 21:18, 8 April 2008 (UTC)

Improvement/source of problems?
With the help of richardk of http://forum.modrewrite.com/viewtopic.php?t=5463 I use the following rules to have the added side-benefit that old links to URLs using index.php are automatically redirected to the new URL scheme. This means that http://sitename/index.php/Main_Page will redirect to http://sitename/wiki/Main_Page. This is my .htaccess

Options All Options -Indexes RewriteEngine On RewriteRule ^wiki/index.php(/(.*))?$ /wiki/$2 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki(/(.*))?$ w/index.php?title=$2 [QSA,L]

I notice that some things are broken - images or attachments retrieved through cached search engine results return 404s (well, wiki pages that don't exist). So the search result is http://sitename/wiki/images/e/eb/file.doc which is not there, but changing that to http://sitename/w/images/e/eb/file.doc allows one to retrieve the file correctly. Does that also happen with the generic rules, or is it a bug introduced by the rules I use which provide backwards compatibility? Apapadop 12:12, 9 April 2008 (UTC)

Internationalisation
It seems the above rules do not allow other language versions of the wiki to work properly. It used to be the case that http://sitename/index.php/Main_Page had a Spanish counterpart of http://sitename/es/index.php/Portada. With the new URL scheme (http://sitename/wiki/Main_Page) one would expect http://sitename/wiki/es/Portada to work, but it is broken - points to a non-existing wikipage of the english wiki. Adjusting the LocalSettings.php within the w/es/ folder does not fix it... any hints? Apapadop 23:19, 20 April 2008 (UTC)

Hi! Had the same problem, solved it by rewriting the URL for both the articles and the scripts.

In the LocalSettings.php I put:

$wgScriptPath          = "/w/sv"; $wgScript              = "$wgScriptPath/index.php"; $wgRedirectScript      = "$wgScriptPath/redirect.php"; $wgArticlePath 		= "/wiki/sv/$1";

And in the .htaccess I put:

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^wiki/sv/(.*)$ mediawiki/mediawiki-1.12.0/index.php/$1 [PT,L,QSA] RewriteRule ^wiki/sv/*$ wiki/sv/ [L,QSA] RewriteRule ^/*$ wiki/sv/ [L,QSA] RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^w/sv/(.*)$ mediawiki/mediawiki-1.12.0/$1 [PT,L,QSA] RewriteRule ^w/sv/*$ w/sv/ [L,QSA] RewriteRule ^/*$ w/sv/ [L,QSA]

I'm no mod_rewrite hacker, but it works! Maria --80.216.88.128 18:37, 16 June 2008 (UTC)

Mediawiki & Wordpress
I can only seem to get the wiki to rewrite or the wordpress to rewrite properly. Does any one have any advise?

This is my .htaccess so far: Options All Options -Indexes RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteBase / RewriteRule. /index.php [L] RewriteRule ^wiki/index.php(/(.*))?$ /wiki/$2 [R=301,L] RewriteRule ^wiki(/(.*))?$ w/index.php?title=$2 [QSA,L]

The following two lines from the above code snippet are for wordpress: RewriteBase / RewriteRule. /index.php [L]

Strmtrupr2 23:07, 26 April 2008 (UTC)

Solution
What solved the problem to me was placing the code listed in Improvement/Source of Problems above Wordpress' ModRewrite rules. This is the way it looks for me (Wordpress 2.5.1 on root dir + MediaWiki 1.12.0 installed on /w dir + PHP 5.2.1):

 Options All Options -Indexes

RewriteEngine On

RewriteRule ^wiki/index.php(/(.*))?$ /wiki/$2 [R=301,L]

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

 RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule. /index.php [L] 
 * 1) BEGIN WordPress


 * 1) END WordPress

Rodrigolj 13:34, 8 May 2008 (UTC)

MediaWiki/RewriteBase
Also note that on some webhosts, you need to add a RewriteBase to the .htaccess file for it to work. PseudoOne 01:50, 13 February 2009 (UTC)

Slash at the beginning of real url
Compare RewriteRule ^wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA] with RewriteRule ^wiki/(.*)$ w/index.php?title=$1 [PT,L,QSA]

The latter seems slightly more robust (if you move your wiki into a subdirectory, you don't need to change anything). Are there any disadvantages to it? --Tgr 16:47, 25 February 2009 (UTC)

Configuration on a "wiki.domain.com" website
I have a wiki installed in a subdomain "wiki.mydomain.com" with no root access and a "httpdocs" folder

And my LocalSettings.php file like this: $wgScriptPath = ""; $wgArticlePath = "/wiki/$1"; --Yova 09:59, 6 March 2009 (UTC)

Resolved-Help Me
Basically I did everything on the manual.

When I go on homepage it works. When I click on a link like news, it goes to www.example.com.wiki.news and it says oops no file there.

Help me

Sachein 16:32, 21 March 2009 (UTC)

fixing old link format
This is mostly working for me, but I've got a new issue. In my previous configuration I had the wiki directory named '/wiki'. This guide frowns on that, so I renamed the directory to '/w/' and then made the changes to LocalSettings.php and .htaccess.

Connections to the new structure work fine now, but any links I created before this change are now broken. I need a RewriteRule that will forward old links (http://www.domain.com/wiki/index.php5?title=Page_Name) to the new wiki directory structure (http://www.domain.com/wiki/Page_Name).