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)

This worked for me! I am running on a GoDaddy Shared Hosting account, and changing my .htaccess file (in my root directory) to these exact contents made everything work perfectly.

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'm using these rewrite rules (the first one is the one I wrote myself to try to fix this issue)

RewriteRule ^wiki/index.php5\?title\=(.*)$ /w/index.php5?title=$1 [R,L] RewriteRule ^wiki/(.*)$ /w/index.php5?title=$1 [PT,L,QSA] RewriteRule ^wiki/*$ /w/index.php5 [L,QSA]

But that doesn't work. If I follow a URL from my previous configuration, like http://www.domain.com/wiki/index.php5?title=Page_Name, it takes me to http://www.domain.com/wiki/Index.php5, which is says is not a file. I think it might first go to the same URL with a lower-case 'i' in index.php5, then it forwards to the upper case version. None of this behavior makes much sense to me, which is par for the course on regular expressions.

I've tested that first rule out with online regular expression testers and it seems to be generating what I need it to. Maybe it's an issue with the flags? --Crutledge 18:56, 1 April 2009 (UTC)

I get exactly the same problem described by Crutledge ! any ideas ?

&returnto= creates No Such Special Page error
I am on a shared host with WP and MediaWiki in a subdirectory (/community) - everything works fine except for the following situation. I'm using SocialProfiles extension and when a user receives a notification of a board posting in their email and clicks through to see it when not logged in, it sends them to the following url: http://openforumfoundation.org/community/Special:UserLogin&returnto=Special:UserBoard with the No Such Special Page error. At the same time, at the bottom of the error page, it includes the line: Return to Special:UserBoard. So it recognizes the returnto designation. If the full original url is entered, everything works as expected: http://openforumfoundation.org/w/index.php?title=Special:UserLogin&returnto=Special:UserBoard Similarly, if just the following is entered: http://openforumfoundation.org/community/Special:UserLogin& it gives the No Such Special Page error, but without the Return to Special:Userboard message (obviously).

Does this make any sense to anyone? Below is my full .htaccess:  Options All Options -Indexes RewriteEngine On RewriteRule ^community/index.php/(.*)$ /community/$1 [R=301,L] RewriteRule ^community/favicon.ico$ w/favicon.ico [L] RewriteRule ^community/(.*)$ /w/index.php\?title=$1 [L,QSA]   RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule. /index.php [L]  Thanks --Wmburke 01:59, 6 June 2009 (UTC)
 * 1) BEGIN WordPress
 * 1) END WordPress


 * Looks like a bug in SocialProfiles. —Emufarmers(T 06:47, 6 June 2009 (UTC)


 * I see of what you speak - I'll repost over there - thanks --Wmburke 14:09, 6 June 2009 (UTC)

New info: the following works fine: http://openforumfoundation.org/community/Special:UserLogin?returnto=Special:UserBoard (the ? in place of the &) so it's not a SocialProfiles bug. It's a basic short URLs issue. I can't seem to find any references to this sort of problem however, and the solutions for the Ampersand problem discussed on the main page do not solve this.

Any suggestions on where I should look or what I should do? --Wmburke 19:46, 8 June 2009 (UTC)

Can't Get It To Work
Hi- I use Joomla on my main public_html directory as a CMS and then installed my wiki to /wiki. I wanted to let people access the site through /staff but have MediaWiki installed to /wiki. I put the following into my .htaccess file on my public_html directory under all of the Joomla required-things:

RewriteEngine On RewriteRule ^staff/(.*)$ /wiki/index.php?title=$1 [PT,L,QSA] RewriteRule ^staff/*$ /wiki/index.php [L,QSA]

and I also added the following lines to the almost very bottom of my LocalSettings.php file:

$wgScriptPath = "/wiki"; $wgArticlePath = "/staff/$1"; $wgUsePathInfo = true;

I am doing something wrong at all or is there another setting I need to change somewhere to let it work? I've cleared my cache and still the URLs on the /wiki directory (where MW is installed) all redirect to the /staff directory and that directory comes up as a 404 on my server no matter what page you get redirected to. Please help! Thanks.

The short URL not work ...
Hello, i have a mediawiki on a host named "Free".

my wiki is http:*//jivacw.free.fr/wiki/ (remove * for see my wiki)

so i go to localsettings.php, i search this line: $wgScriptPath = "/wiki";

so i put $wgArticlePath = "/acwiki/$1"; $wgUsePathInfo = true;

and i go to htaccess and i put (above they are :

RewriteEngine On RewriteRule ^wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA] RewriteRule ^wiki/*$ /w/index.php [L,QSA] RewriteRule ^/*$ /w/index.php [L,QSA]

and when i go to the directory /wiki/ for see my wiki BANG!

500 Internal servor error

I boried please help me!


 * Well that's kind of normal. You say in the htacess that your wiki is based on the path "/w/" which doesn't exist at all. You need to replace "/w/" by "/wiki/" AND change the wiki/(.*) by acwiki/(.*) as it's the virtual folder you want to use. the same thing for wiki/*$ --kronoxt (d) 06:35, 12 August 2009 (UTC) by the way I'm not sure if free accept the Url rewriting engine... anyways.

Subpages Not Working
I have everything working fine except for subpages that use a "/". For example, http://mydomain.com/wiki/User:Euicho works but http://mydomain.com/wiki/User:Euicho/Sandbox fails with a 404. I can see why this is, but I do not know how to fix it. Does anyone else have this problem and/or a solution? Thanks! Euicho 20:00, 31 July 2009 (UTC)


 * Well me it's working with subpages... maybe an error in the .htaccess configuration.
 * My htaccess looks like >

 RewriteEngine On RewriteRule ^w/(.*)$ /index.php?title=$1 [PT,L,QSA] RewriteRule ^w/*$ /index.php [L,QSA] RewriteRule ^/*$ /index.php [L,QSA]


 * It sure that if you use the method as described to make the base of the domain the virtual link


 * the virtual link "is" the main folder.... that won't work for subpages and there's no way to fix it to my knowledge. Well there's a way... replace (in the source code) the "/" for a "." for subpages like User:Frank.Sandbox but that's dangerous as you need to transform the source code. So that's one of the reason why your "/wiki/" need to be virtual. and I think the second alternative on the manual should be deprecated.


 * kronoxt (d) 06:23, 12 August 2009 (UTC)

1and1, Domain Forwarding, (no root access)
It took me a long time to work out the solution, but I realized it all stemmed back to my Domain settings in the 1and1 control panel - I had the domain pointed to the directory "/w", where the mediawiki was installed, and the wiki site was loading and working fine (just with long URLs). Once I pointed the directory to the root "/", and some trial and error, the following worked for me:


 * LocalSettings.php
 * $wgScriptPath      = "/w";
 * $wgScriptExtension = ".php";
 * $wgArticlePath = "/wiki/$1";
 * $wgUsePathInfo = true;
 * $wgLogo = "/w/skins/common/images/wiki.png";


 * .htaccess
 * AddType x-mapp-php5 .php  ##<-this line req. for PHP5 to run (regardless of URLs)
 * RewriteEngine On
 * RewriteRule ^wiki/(.*)$ /w/index.php5?title=$1 [PT,L,QSA]
 * RewriteRule ^wiki/*$ /w/index.php5 [L,QSA]
 * RewriteRule ^/*$ /w/index.php5 [L,QSA]

BTW, I'm running 1.15.2. --DustinPaddock 03:52, 25 March 2010 (UTC)Dustin

Well, yes thank you. To adjust the rootdirectory of the subdomain to a directory above the installation directory is the only way for 1und1. --Stexan 15:56, 28 September 2010 (UTC)

Godaddy or Bluehost example
Are the Godaddy or Bluehost examples assuming that the name of your wiki is hindupedia? What is the purpose of those special instructions; why are they needed? Tisane 08:19, 17 May 2010 (UTC)