Help:Pretty URIs

From semantic-mediawiki.org
Jump to: navigation, search
SMW admin manual
Installation
Configuration
Concept caching
Pretty URIs
Using SPARQL and RDF stores
Troubleshooting
Repairing SMW's data
Extensions
Basic extensions
Semantic extensions
SMW user manual

If one wants to have pretty URIs (or "cool URIs"), more compliant to linked data principles, some settings for MediaWiki and SemanticMediaWiki are necessary. Here is how it works, exemplified for semanticweb.org.

Aim

For each page in the wiki one wants to have properly defined identifiers:

Necessary Steps

For that, one needs to do:

1) Tell LocalSettings.php to use shorter URLs

// Pretty URIs MW
$wgScriptPath = "/";            # Path to the actual files.
$wgArticlePath = "/wiki/$1";    # Virtual path. This directory MUST be different from the one used in $wgScriptPath
$wgUsePathInfo = true;          # Enable use of pretty URLs

//Namespace config SMW
$smwgNamespace = 'http://semanticweb.org/id/';

2) Define alias and rewrite rules in apache webserver (httpd.conf)

# Define Alias
Alias /wiki C:/webserver/htdocs/LinkedDataSMW/index.php

# Rewrite to URIResolver of SMW
RewriteRule ^/id/(.*) /wiki/Special:URIResolver/$1 [L,P]

→ For MW specific information and alternatives, see here.


This documentation page applies to all SMW versions from 1.5.0 to the most current version.
      Other languages: dezh-hans

Help:Pretty URIs en 1.5.0