I managed to get .htaccess Rewrite to work and yield pretty URL's for a basic setup like this:
www.mydomain.com/wiki/index.php/Main_Page
The wiki is installed in w/ and the pages show the user the nice wiki/ URL's.
Now I'd like to change the external URL to my wiki to be:
wiki.mydomain.com/index.php/Main_Page
Where wiki is an empty directory because the wiki code is still in w/
Some noob questions:
Does the .htaccess file need to be in the wiki directory rather than the root directory? I assume so since it's like a different site. I can't seem to get it to recognize where the w/ directory is. For example, this htaccess in the wiki directory yields the correct URL but a 404 error on the wiki:
RewriteRule ^index.php/(.*)$ /w/index.php?title=$1 [L,QSA]
I've tried more explicitly specifying the 'to' rule but it just yields a mess. If I move .htaccess up one level to the domain.com/ root, then it seems the rules don't recognize that wiki.domain.com is valid.
So if anyone has made the pretty URL rewrite rules work for a subdomain, I'd appreciate knowing what you did.
Michelle
For / as with: http://wiki.mydomain.com/index.php/Main_Page
php_flag register_globals off RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?title=$1 [L,QSA]
--+
For /wiki as with: http://www.mydomain.com/wiki/index.php/Main_Page
php_flag register_globals off RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /wiki/index.php?title=$1 [L,QSA]
Thanks, but don't you need to have the virtual directory separate from the real code directory, eg (for non-subdomain case):
RewriteRule ^wiki/index.php/(.*)$ /w/index.php?title=$1 [L,QSA]
Or is that not required if it's a subdomain?
Michelle
On May 14, 2006, at 7:34 PM, Sy Ali wrote:
For / as with: http://wiki.mydomain.com/index.php/Main_Page
php_flag register_globals off RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?title=$1 [L,QSA]
On 5/14/06, Michelle michelle.sg1@gmail.com wrote:
Thanks, but don't you need to have the virtual directory separate from the real code directory, eg (for non-subdomain case):
RewriteRule ^wiki/index.php/(.*)$ /w/index.php?title=$1 [L,QSA]
Or is that not required if it's a subdomain?
All I know is that it works for me. =)
I don't like using /w or /wiki when I can avoid it.. yes, this means that I cannot have certain page names in my wiki because they are real files my htdocs root.
Hallo, Michelle,
Du meintest am 14.05.06 zum Thema Re: [Mediawiki-l] .htaccess/rewrite help for subdomain:
Thanks, but don't you need to have the virtual directory separate from the real code directory, eg (for non-subdomain case):
RewriteRule ^wiki/index.php/(.*)$ /w/index.php?title=$1 [L,QSA]
Perhaps you need too
RewriteBase /wiki.mydomain.com/
and then
RewriteRule (.*)$ index.php?title=$1 [L,QSA]
together with the "RewriteCond" lines
Viele Gruesse! Helmut
Hallo, Michelle,
Du meintest am 14.05.06 zum Thema [Mediawiki-l] .htaccess/rewrite help for subdomain:
I managed to get .htaccess Rewrite to work and yield pretty URL's for a basic setup like this:
www.mydomain.com/wiki/index.php/Main_Page
[...]
Does the .htaccess file need to be in the wiki directory rather than the root directory? I assume so since it's like a different site. I can't seem to get it to recognize where the w/ directory is. For example, this htaccess in the wiki directory yields the correct URL but a 404 error on the wiki:
RewriteRule ^index.php/(.*)$ /w/index.php?title=$1 [L,QSA]
I have the following directory structure and ".htaccess" file:
------------------------------------ Directory:
drwxr-xr-x 14 xxxxx vmusers 4096 May 15 09:40 mediawiki-1.6.1 lrwxrwxrwx 1 xxxxx vmusers 4 Apr 1 11:41 wiki -> Wiki lrwxrwxrwx 1 xxxxx vmusers 15 Apr 6 15:04 Wiki -> mediawiki-1.6.1
File ".htaccess" in "mediawiki-1.6.1"
# if you want to use mod_rewrite, set this 'On' RewriteEngine On
# the path to your installation RewriteBase /Wiki/
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?title=$1 [L,QSA] #
------------------------------------
You ca see the result at
A minor thing: when I go from the main page to "5.6 Zusatzprogramme" and there to "openVPN", I see the long URL.
http://arktur.de/Wiki/index.php?title=Zusatzprogramme:openvpn
But when I delete
index.php?title=
all works fine.
Viele Gruesse! Helmut
mediawiki-l@lists.wikimedia.org