Go Back   NuHIT - SEO, Wiki, Forums > Third Party Software Packages > MediaWiki
Reply
 
Thread Tools
 
#1
Old 08-08-2007, 11:23 AM
 
MaestroX
Premium Member
 
Join Date: Jan 2007
Posts: 279
MaestroX is offline  

MediaWiki Clean URLs for PHP (compiled as CGI)


MediaWiki has issues when attempting to use "clean URLs" (e.g. http://www.mywiki.com/wiki/Main_Page) on a system with PHP compiled as a CGI. This is a workaround to successfully enable clean URLs while maintaining full compatibility with the server configurations

1) Create a blank .htaccess file located in your wiki's directory or in public_html if your wiki is installed on the root directory. For example, if you have your wiki installed at www.mywiki.com/wiki, you'd want to create the .htaccess file in /home/mywiki/public_html/wiki/ server directory. Alternatively, if you have it at www.mywiki.com, create in /home/mywiki/public_html/

2) edit and save the .htaccess file with following contents:

NOTE: If you have the Wiki installed on the root directory, remove references to /Wiki/ in the following code.

Code:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/wiki/(stylesheets|images|skins|Skins|Images|Stylesheets)/
RewriteCond %{REQUEST_URI} !^/wiki/(stylesheets|images|skins|Skins|Images|Stylesheets)
RewriteCond %{REQUEST_URI} !^/wiki/(redirect|texvc|index).php
RewriteCond %{REQUEST_URI} !^/wiki/(40(1|3|4)|500).shtml
RewriteCond %{REQUEST_URI} !^/wiki/favicon.ico
RewriteCond %{REQUEST_URI} !^/wiki/robots.txt
RewriteRule ^wiki/(.*) wiki/index.php?title=$1 [L,QSA]
RewriteRule ^wiki/Skins/(.*) wiki/skins/$1 [L,QSA]
RewriteRule ^wiki/Images/(.*) wiki/images/$1 [L,QSA]
3) edit your Wiki's LocalSettings.php file as follows:

Code:
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
$wgScriptPath = "/wiki";
$wgScript = "$wgScriptPath/index.php";
$wgRedirectScript = "$wgScriptPath/redirect.php";
$wgArticlePath = "/wiki/$1";
That's it! Hope this helps anyone that has been having problems.

Notes/Known Issues

Above code only compatible for PHP compiled as a CGI. Apache-based PHP installs do not require anything special, use the default instructions that come with mediaWiki instead
Reply With Quote

#2
Old 08-30-2007, 06:54 AM
 
Exclamation

For better SEO when using this rewrite I recommend creating a robots.txt like this:

Code:
User-agent: *
Disallow: /wiki/index.php
Disallow: /wiki/skins/
Disallow: /wiki/bin/
Disallow: /wiki/config/
Disallow: /wiki/docs/
Disallow: /wiki/extensions/
Disallow: /wiki/includes/
Disallow: /wiki/languages/
Disallow: /wiki/locale/
Disallow: /wiki/maintenance/
Disallow: /wiki/math/
Disallow: /wiki/session/
Disallow: /wiki/t/
Disallow: /wiki/tests/
Remeber to modify the directory if your Wiki does not reside in /wiki/ of your site.
MaestroX
Premium Member
 
Join Date: Jan 2007
Posts: 279
MaestroX is offline  
Reply With Quote

#3
Old 08-30-2007, 10:20 AM
 
ElfMage
nuHIT Team
 
ElfMage's Avatar
 
Join Date: Aug 2006
Posts: 3,602
ElfMage is offline  
Thanks MaestroX, this is good information.
Reply With Quote

#4
Old 08-30-2007, 11:08 AM
 
No Problem, there are many ways out there but many are faulty. So far this one works in 99% of cases.

Also the robots.txt is very helpfull to stop bots looking at edit pages and keep them on content pages only.
MaestroX
Premium Member
 
Join Date: Jan 2007
Posts: 279
MaestroX is offline  
Reply With Quote

#5
Old 03-24-2008, 03:04 PM
 
bowie
Premium Member
 
Join Date: May 2007
Posts: 20
bowie is offline  
Hi,
One question. I have a problem with accents or puntuation simbols (', ¨¨, ^, etc) , if i use them on my tittle then i don't get a clean or clear URL.
For example, i have one article called: Papiros Médicos
and i get this horrible URL:
http://www.egiptoforo.com/antiguo/Papiros_M%C3%A9dicos

Is there a solution for this?

Thanx
__________________

Reply With Quote

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MediaWiki URLs Underscore to Dash Gusto MediaWiki 4 03-16-2007 02:28 PM
MediaWiki SEF URLs ElfMage General Discussions 0 02-10-2007 02:37 PM
How can I clean up wiki screen, remove features? mike the mix vbWiki Pro - Installation and Support 7 01-30-2007 06:16 PM


All times are GMT -4. The time now is 04:18 AM.