Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri May 07, 2010 3:59 am 
Offline
Senior Newbie

Joined: Tue May 04, 2010 4:38 pm
Posts: 15
Website: http://telarapedia.com
Any gurus out there? :)

I have my Mediawiki setup fine for short urls, so that index.php and all that are hidden when articles are viewed. However, I noticed that www. was still working and I don't want it to, so I put this in one of my apache conf files:
Code:
                RewriteCond %{HTTP_HOST} !^domain\.com$ [NC]
                RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

This works brilliantly when you go to the root part of my domain, but if you go to an article in the www. domain, it redirects you to the long url version.

i.e.:
go to www.domain.name redirects you to domain.name
go to www.domain.name/wiki/article redirects you to domain.name/wiki/w/index.php/article

Any of this make sense to anyone? Somehow it totally breaks the short urls in Mediawiki. I don't think it will be very common for someone to use the www. for anything but the page page (and this redirects fine), but it's still weird.


Top
   
 Post subject:
PostPosted: Fri May 07, 2010 9:02 pm 
Offline
Junior Member

Joined: Mon Apr 26, 2010 12:20 am
Posts: 22
Website: http://www.halloforigin.com
Try this.


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



Tell me how it works. :D


Top
   
 Post subject:
PostPosted: Sat May 08, 2010 6:38 am 
Offline
Senior Newbie

Joined: Tue May 04, 2010 4:38 pm
Posts: 15
Website: http://telarapedia.com
Thanks, but I noticed something that might not work well with this?

Here's all the relevant info in the file for this domain (will the Alias statements clash with what you typed?):
Code:
                RewriteEngine on
                DirectoryIndex index.php
                RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
                RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
                RewriteCond %{REQUEST_URI} !^wiki/extensions/*
                RewriteCond %{REQUEST_URI} !^w/extensions/*

Alias /w/index.php /var/www/w/index.php
Alias /wiki /var/www/w/index.php
Alias /index.php /var/www/w/index.php
Alias /w/skins/ /var/www/w/skins/
Alias /w/extensions/ /var/www/w/extensions/



Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group