HOWTO: URL rewrite rules

This page contains URL rewrite rules for some Content Management Systems, wiki's, webmail and other webprograms.

Banshee

Use the following configuration for your Banshee websites:

UrlToolkit {
    ToolkitID = banshee
    RequestURI isfile Return
    Match ^/(css|files|images|js)(/|$) Return
    Match ^/(favicon.ico|robots.txt|sitemap.xml)$ Return
    Match .*\?(.*) Rewrite /index.php?$1
    Match .* Rewrite /index.php
}

CakePHP

Use the following configuration for your CakePHP websites:

UrlToolkit {
    ToolkitID = cakephp
    RequestURI exists Return
    Match .* Rewrite /index.php
}

CodeIgniter

Use the following configuration for your CodeIgniter websites:

UrlToolkit {
    ToolkitID = codeigniter
    RequestURI exists Return
    Match ^/(index\.php|images|robots\.txt) Return
    Match .* Rewrite /index.php
}

Concrete5

Use the following configuration for your Concrete5 websites:

UrlToolkit {
    ToolkitID = concrete5
    RequestURI exists Return
    Match ^/index.php Return
    Match ^/(.*)\?(.*) Rewrite /index.php/$1&$2
    Match ^/(.*) Rewrite /index.php/$1
}

Contao

Use the following configuration for your Contao websites:

UrlToolkit {
    ToolkitID = contao
    RequestURI exists Return
    Match /contao/(.*)\?(.*) Rewrite /contao/index.php?id=$1&$2
    Match /contao/(.*) Rewrite /contao/index.php?id=$1
}

CraftCMS

Use the following configuration for your CraftCMS websites:

UrlToolkit {
    ToolkitID = craftcms
    RequestURI exists Return
    Match ^/(.*)\?(.*) Rewrite /index.php?p=$1&$2
    Match ^/(.*) Rewrite /index.php?p=$1
}

DokuWiki

Use the following configuration for your DokuWiki websites:

UrlToolkit {
    ToolkitID = dokuwiki
    Match ^/(bin|conf|data|inc)/ DenyAccess
    Match ^/_media/(.*)\?(.*) Rewrite /lib/exe/fetch.php?media=$1&2
    Match ^/_media/(.*) Rewrite /lib/exe/fetch.php?media=$1
    Match ^/_detail/(.*)\?(.*) Rewrite /lib/exe/detail.php?media=$1&$2
    Match ^/_detail/(.*) Rewrite /lib/exe/detail.php?media=$1
    Match ^/_export/([^/]+)/(.*) Rewrite /doku.php?do=export_$1&id=$2
    Match ^/$ Rewrite /doku.php
    RequestURI exists Return
    Match /(.*)\?(.*) Rewrite /doku.php?id=$1&$2
    Match /(.*) Rewrite /doku.php?id=$1
}

Drupal

Use the following configuration for your Drupal websites:

UrlToolkit {
    ToolkitID = drupal
    RequestURI isfile Return
    Match ^/favicon.ico$ Return
    Match /(.*)\?(.*) Rewrite /index.php?q=$1&$2
    Match /(.*) Rewrite /index.php?q=$1
}

GetSimple

Use the following configuration for your GetSimple websites:

UrlToolkit {
    ToolkitID = getsimple
    Match ^/(data/uploads|data/thumbs)/ Skip 1
    Match ^/(data|plugins|backups)/ DenyAccess
    RequestURI exists Return
    Match ^(.*)*/([A-Za-z0-9\-]+)/?$ Rewrite /index.php?id=$2
}

Git HTTP backend

Use the following configuration for your Git HTTP backend websites:

CGIextension = cgi

VirtualHost {
    ...
    ExecuteCGI = yes
    NoExtensionAs = cgi
    EnablePathInfo = yes
    ScriptAlias = /git:/usr/libexec/git-core/git-http-backend
    Setenv GIT_PROJECT_ROOT = /var/www/git
    Setenv GIT_HTTP_EXPORT_ALL =
}

Habari

Use the following configuration for your Habari websites:

UrlToolkit {
    ToolkitID = habari
    Match ^/(system/(classes|locale|schema|$)) Rewrite /index.php
    RequestURI exists Return
    Match .*\?(.*) Rewrite /index.php?$1
    Match .* Rewrite /index.php
}

jCore

Use the following configuration for your jCore websites:

UrlToolkit {
    ToolkitID = jcore
    RequestURI exists Return
    Match /(.*)\?(.*) Rewrite /index.php?path=$1&$2
    Match /(.*) Rewrite /index.php?path=$1
}

Joomla!

Use the following configuration for your Joomla! websites:

UrlToolkit {
    ToolkitID = joomla
    Match base64_encode.*\(.*\) DenyAccess
    Match (<|%3C).*script.*(>|%3E) DenyAccess
    Match GLOBALS(=|\[|\%[0-9A-Z]{0,2}) DenyAccess
    Match _REQUEST(=|\[|\%[0-9A-Z]{0,2}) DenyAccess
    RequestURI exists Return
    Match /index.php Return
    Match ^/component/ Skip 2
    Match !^(/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ Skip 1
    Match .* Rewrite /index.php
}

Kohana

Use the following configuration for your Kohana websites:

UrlToolkit {
    ToolkitID = kohana
    Match ^/(application|modules|system) DenyAccess
    RequestURI exists Return
    Match ^/(.*) Rewrite /index.php?kohana_uri=$1
}

Set $config['site_domain'] to '/' and $config['index_page'] to ''.

Laravel

Use the following configuration for your Laravel websites:

UrlToolkit {
    ToolkitID = laravel
    RequestURI exists Return
    Match .* Rewrite /index.php
}

MediaWiki

Use the following configuration for your MediaWiki websites:

UrlToolkit {
    ToolkitID = mediawiki
    RequestURI exists Return
    Match /wiki/(.*) Rewrite /index.php?title=$1
}

VirtualHost {
    ...
    TriggerOnCGIstatus = false
    UseToolkit = mediawiki
}

Set $wgArticlePath to "/wiki/$1" in LocalSettings.php. If you often see white pages, set $wgEnableParserCache and $wgCachePages to false. Yes, this is due to a bug in MediaWiki's caching routines.

MODx

Use the following configuration for your MODx websites:

UrlToolkit {
    ToolkitID = modx
    RequestURI exists Return
    Match ^/(.*)$ Rewrite /index.php?q=$1
}

Nibbleblog

Use the following configuration for your Nibbleblog websites:

UrlToolkit {
    ToolkitID = nibbleblog
    Match ^/admin$ Rewrite /admin.php?controller=user&action=login
    Match ^/category/([^/]+)/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&category=$1&number=$2
    Match ^/category/([^/]+)/$ Rewrite /index.php?controller=blog&action=view&category=$1&number=0
    Match ^/tag/([^/]+)/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&tag=$1&number=$2
    Match ^/tag/([^/]+)/$ Rewrite /index.php?controller=blog&action=view&tag=$1&number=0
    Match ^/page-([0-9]+)$ Rewrite /index.php?controller=blog&action=view&number=$1
    Match ^/post/([^/]+)/$ Rewrite /index.php?controller=post&action=view&post=$1
    Match ^/post-([0-9]+)/(.*)$ Rewrite /index.php?controller=post&action=view&id_post=$1
    Match ^/page/([^/]+)/$ Rewrite /index.php?controller=page&action=view&page=$1
    Match ^/feed/$ Rewrite /feed.php
    Match ^/([^/]+)/$ Rewrite /index.php?controller=page&action=$1
}

October

Use the following configuration for your October websites:

UrlToolkit {
    ToolkitID = october
    Match /themes/.*/(layouts|pages|partials)/.*.htm Rewrite /index.php
    Match /uploads/protected/.* Rewrite /index.php
    RequestURI file Return
    Match .* Rewrite /index.php
}

Phalcon

Use the following configuration for your Phalcon websites:

UrlToolkit {
    ToolkitID = phalcon
    Match ^/public/ Skip 1
    Match ^/(.*) Rewrite /public/$1 Continue
    RequestURI exists Return
    Match (.*)\?(.*) Rewrite $1&$2 Continue
    Match ^/public/(.*) Rewrite /public/index.php?_url=/$1
}

phpSQLiteCMS

Use the following configuration for your phpSQLiteCMS websites:

UrlToolkit {
    ToolkitID = phpsqlitecms
    RequestURI exists Return
    Match ^/(.*) Rewrite /index.php?qs=$1
}

PluXml

Use the following configuration for your PluXml websites:

UrlToolkit {
    ToolkitID = pluxml
    Match ^/data/configuration DenyAccess
    RequestURI exists Return
    Match ^/tag/(.*)$ Rewrite /index.php?tag/$1
    Match ^/categorie([A-Za-z0-9\-]+)/(.*)$ Rewrite /index.php?categorie$1/$2
    Match ^/article([A-Za-z0-9\-]+)/(.*)$ Rewrite /index.php?article$1/$2
    Match ^/feed/rss/(.*)$ Rewrite /feed.php?rss$1
    Match ^/feed/rss$ Rewrite /feed.php?rss$1
    Match ^/archives/(.*)/(.*)$ Rewrite /index.php?archives/$1/$2
    Match ^/static([A-Za-z0-9\-]+)/(.*)$ Rewrite /index.php?static$1/$2
}

ProcessWire

Use the following configuration for your ProcessWire websites:

UrlToolkit {
    ToolkitID = processwire
    Match /site/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) DenyAccess
    Match /site/assets.*/-.+/.* DenyAccess
    Match /(wire|site)/(config|index\.config|config-dev)\.php$ DenyAccess
    Match /(wire|site)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ DenyAccess
    Match /site/templates($|/|/.*\.(php|html?|tpl|inc))$ DenyAccess
    Match /site/assets($|/|/.*\.php)$ DenyAccess
    Match /wire/(core|modules)/.*\.(php|inc|tpl|module|info\.json)$ DenyAccess
    Match /site/modules/.*\.(php|inc|tpl|module|info\.json)$ DenyAccess
    RequestURI exists Return
    Match ^/(.*\/?)?\?(.*)$ Rewrite /index.php?it=$1&$2
    Match ^/(.*)$ Rewrite /index.php?it=$1
}

Pydio

Use the following configuration for your Pydio websites:

UrlToolkit {
    ToolkitID = pydio
    Match ^/data DenyAccess
    RequestURI exists Return
    Match ^/shares Rewrite /dav.php
    Match ^/api Rewrite /rest.php
    Match ^/user Rewrite /index.php?get_action=user_access_point
}

During the installation process, you need to set MaxUrlLength = 3000.

RoundCube

Use the following configuration for your RoundCube websites:

UrlToolkit {
    ToolkitID = roundcube
    Match (/.*\.inc|^_.*) DenyAccess
    Match /mail/logs/.* DenyAccess
    Match /mail/temp/.* DenyAccess
    Match /mail/config/.* DenyAccess
}

SilverStripe

Use the following configuration for your SilverStripe websites:

UrlToolkit {
    ToolkitID = silverstripe
    RequestURI isfile Return
    Match (.*)\?(.*) Rewrite $1&$2 Continue
    Match ^/(.*) Rewrite /sapphire/main.php?url=$1
}

VirtualHost {
    ...
    TriggerOnCGIstatus = no
    UseToolkit = silverstripe
}

Symfony2

Use the following configuration for your Symfony2 websites:

UrlToolkit{
    ToolkitID = Symfony2
    RequestURI isfile Return
    Match .* Rewrite /app.php
}

Symphony

Use the following configuration for your Symphony websites:

UrlToolkit {
  ToolkitID = symphony
  Match ^/manifest/.* DenyAccess
  Match ^/workspace/utilities/.*\.xsl$ DenyAccess
  Match ^/workspace/pages/.*\.xsl$ DenyAccess
  Match ^/.*\.sql$ DenyAccess
  Match ^/favicon.ico$ Return
  Match ^/image\/(.+\.(jpg|gif|jpeg|png|bmp))$ Rewrite /extensions/jit_image_manipulation/lib/image.php?param=$1
  Match ^/symphony\/?$ Rewrite /index.php?mode=administration
  RequestURI exists Return
  Match ^/(.*)\?(.*) Rewrite /$1&$2 Continue
  Match ^/symphony(\/(.*\/?))?$ Rewrite /index.php?symphony-page=$1&mode=administration
  Match ^/(.*\/?)$ Rewrite /index.php?symphony-page=$1
}

Textpattern CMS

Use the following configuration for your Textpattern CMS websites:

UrlToolkit {
  ToolkitID = textpattern
  RequestURI exists Return
  Match ^/(files|images|js|res)(/|$) Return    
  Match ^/(favicon.ico|robots.txt|sitemap.xml)$ Return     
  Match .*\?(.*) Rewrite /index.php?$1   
  Match ^(.*) Rewrite /index.php
}

TYPO3

Use the following configuration for your TYPO3 websites:

UrlToolkit {
    ToolkitID = typo3
    RequestURI exists Return
    Match .* Rewrite /index.php
}

WolfCMS

Use the following configuration for your WolfCMS websites:

UrlToolkit {
    ToolkitID = wolfcms
    Match ^/site/install/index.html$ Rewrite /site/install/index.php?rewrite=1
    Match ^/site/install/index.php$ Rewrite /site/install/index.php?rewrite=1
    Match ^/site/install/$ Rewrite /site/install/index.php?rewrite=1
    RequestURI exists Return
    Match ^/site/admin(.*)$ Rewrite /site/admin/index.php?$1
    Match ^/site(.*)$ Rewrite /site/index.php?WOLFPAGE=$1
}

The 3 match rules above RequestURI are for clean URL installation. They should be removed after installation.

WordPress

Use the following configuration for your WordPress websites:

UrlToolkit {
    ToolkitID = wordpress
    RequestURI exists Return
    Match .*\?(.*) Rewrite /index.php?$1
    Match .* Rewrite /index.php
}

For a complete instruction about how to use Wordpress with Hiawatha, read Hosting WordPress with Hiawatha by Chris Wadge.

Yii

Use the following configuration for your Yii websites:

UrlToolkit {
    ToolkitID = yii
    RequestURI exists Return
    Match .* Rewrite /index.php
}

Zend

Use the following configuration for your Zend websites:

UrlToolkit {
    ToolkitID = zend
    Match ^/.*\.(js|ico|gif|jpg|jpeg|png|css|svg)(/|$) Return
    Match .* Rewrite /index.php
}

VirtualHost {
    ...
    WebsiteRoot = /path/to/website/public
    UseToolkit = zend

    # Required so that Zend can find the application root directory
    Setenv APPLICATION_PATH = /path/to/website
    # Optional, for more verbose error messsages
    Setenv APPLICATION_ENV = development
}