Skip to content

Advanced configuration installation

Benoît.S edited this page Aug 2, 2014 · 3 revisions

URL Rewriting

For NginX

For NginX you need to set the rewrite rules in your vhost configuration file. Here an example for http://www.example.com/tweets/ :

location /tweets/ {
    rewrite ^/tweets/([0-9]+)/?$ /tweets/index.php?id=$1 last;
    rewrite "^/tweets/archive/([0-9]{4})/([0-9]{2})/([0-9]{2})/?$" /tweets/index.php?year=$1&month=$2&day=$3 last;
    rewrite "^/tweets/archive/([0-9]{4})/([0-9]{2})/([0-9]{2})/page/([0-9]+)/?$" /tweets/index.php?year=$1&month=$2&day=$3&page=$4 last;
    rewrite "^/tweets/archive/([0-9]{4})/([0-9]{2})/?$" /tweets/index.php?year=$1&month=$2 last;
    rewrite "^/tweets/archive/([0-9]{4})/([0-9]{2})/page/([0-9]+)/?$" /tweets/index.php?year=$1&month=$2&page=$3 last;
    rewrite "^/tweets/archive/([0-9]{4})/?$" /tweets/index.php?year=$1 last;
    rewrite "^/tweets/archive/([0-9]{4})/page/([0-9]+)/?$" /tweets/index.php?year=$1&page=$2 last;
    rewrite ^/tweets/client/(.*)/$ /tweets/index.php?client=$1 last;
    rewrite ^/tweets/client/(.*)/page/([0-9]+)/?$ /tweets/index.php?client=$1&page=$2 last;
    rewrite ^/tweets/page/([0-9]+)/?$ /tweets/index.php?page=$1 last;
    rewrite ^/tweets/favorites/?$ /tweets/index.php?favorites=1 last;
    rewrite ^/tweets/favorites/page/([0-9]+)/?$ /tweets/index.php?favorites=1&page=$2 last;
    rewrite ^/tweets/stats/?$ /tweets/index.php?method=stats last;
}
Clone this wiki locally