Common Theme for MediaWiki and WordPress

From Sandro Groganz, Open Source Marketing Consultant

(Redirected from MySite)
Jump to: navigation, search

I have been asked repeatedly via email about details of my site setup, merging MediaWiki and WordPress.

Directory structure

  • <webroot>/design: Side-wide CSS, header, footer, image files.
  • <webroot>/mediawiki: You guessed it, this is where the MediaWiki installation resides.
  • <webroot>/weblog: WordPress is installed here.

Design

You can download my compressed design/ archive.

Make sure you adjust the following parameters in config.php:

  • $_SG_DESIGN['include_path']: Should point to the design/ directory, e.g. /var/www/design/.
  • $_SG_DESIGN['domain']: The URL of your Web root, e.g. http://sandro.groganz.com.

Next, download my WordPress theme, uncompress and move it to <webroot>/weblog/wp-content/themes/. In header.php and footer.php, you will see that I included the relevant files from design/ there. Adjust the paths in the two files in case something does not work out.

In MediaWiki, I created a skin by renaming the default skin folder to sandrogroganz/ and by adding sandrogroganz.php to <webroot>/mediawiki/skins/. This file includes the header and footer from design/.

Rewrite Rules

To glue it all together on the URL level, I created the following rewrite rules.

Content of <webroot>/.htaccess:

<IfModule mod_rewrite.c>
RewriteEngine On

# Canonical hostname
RewriteCond %{HTTP_HOST} !^sandro\.groganz\.com$
RewriteRule ^(.*)$ http://sandro.groganz.com/$1 [L,R=301]

# Redirect old pages
RewriteRule ^about_me$ /wiki/About_Me [L,R=301]
RewriteRule ^about_me/biography$ /wiki/Biography [L,R=301]
RewriteRule ^about_me/contact$ /wiki/Contact_Me [L,R=301]
RewriteRule ^talks(.*)$ /wiki/Talks [L,R=301]

# URLs like example.com/Main_Page
#RewriteRule ^/COPYING$ /mediawiki/COPYING [L]
#RewriteCond %{REQUEST_URI} !^/mediawiki/
#RewriteCond %{REQUEST_URI} !^/(robots\.txt|favicon\.ico|winfwiki\.png|design)
#RewriteRule ^(.*)$ /mediawiki/index.php/$1 [L,NE]
#RewriteRule ^$ /wiki/Overview [L]

# URLs like example.com/wiki/Main_Page
RewriteRule ^wiki/?(.*)$ /mediawiki/index.php?title=$1 [L,QSA]
RewriteRule ^$ /wiki/Overview [L]

#RewriteCond %{REQUEST_URI} ^/.*&.*
</IfModule>

Content of <webroot>/weblog/.htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /weblog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /weblog/index.php [L]
</IfModule>
# END WordPress
Author

Sandro Groganz alias "ordnas" practices and fathoms the art of marketing and community relations in the domain of Open Source. He is founder of InitMarketing, an Open Source marketing consultancy.


Personal tools
  • This page was last modified 17:12, 26 May 2008.
  • This page has been accessed 3,673 times.