Help:Pretty URIs

(Redirected from Cool URIs)
Jump to: navigation, search
SMW admin manual
Concept caching
Fixed properties
Using SPARQL and RDF stores
Pretty URIs
Repairing SMW's data
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


Usually, SMW automatically creates the respective URIs for all resources described, e.g., see Karlsruhe in

However, you may want to have pretty URIs, e.g., see Karlsruhe in

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 = '';

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.

{{#set: |docinfo status=effective }}{{#set: |worn by =Template:Docinfo |warning =Master page updated }}{{#set:

|worn by =Template:Docinfo
|warning =No description

|revision id=40236 |namespace=Help |docinfo progress =100 |docinfo priority =2 }}{{#set:docinfo master page=Help:Pretty URIs }}{{#set:docinfo master rev =40236 }}{{#set:docinfo category=Category:Manual}}{{#set:docinfo author=User:Benedikt Kaempgen}}{{#set:docinfo editor=User:Benedikt Kaempgen}}{{#set:docinfo support=User:Benedikt Kaempgen}}{{#set:docinfo language=en}}

This documentation page applies to all SMW versions from 1.5.0 to the most current version.
Other versions: {{#ask: Docinfo master page::Help:Pretty URIs Docinfo language::en from version::!1.5.0|
   ?from version = |
   ?to version = |
   sort = from version|
   order = desc|
   sep=, |
   limit = 3|
   searchlabel = […]
  }}       Other languages: {{#ask: Docinfo master page::Help:Pretty URIs from version::1.5.0 Docinfo language::!en|
  ?Docinfo language =|
  sep=, |
  sort = Docinfo language|
  order = asc|
  limit = 10|
  searchlabel = […]

Docinfo master page::Help:Pretty URIs Docinfo language::en from version::1.5.0

{{#set:Release status=current}}

{{#set:Is master page=true}}