Alias / "/usr/share/sticky-notes/" 

<Directory /usr/share/sticky-notes/>
#    Allow from all
#    AllowOverride all
#    Options None
#    Order allow,deny
    <IfModule mod_rewrite.c>
    # Tell PHP that rewrite rules are available
    SetEnv HTTP_MOD_REWRITE On

    # Rewrite rules
    RewriteEngine on

    RewriteBase /
    # Setup link
    RewriteRule ^install/?$ install.php [NC]

    # Documentation links
    RewriteRule ^doc/([a-z]+)/?$ doc.php?cat=$1 [NC]
    RewriteRule ^~([a-z.]+)/doc/([a-z]+)/?$ doc.php?project=$1&cat=$2 [NC]

    # Home page links
    RewriteRule ^~([a-z.]+)/?$ index.php?project=$1 [NC]
    RewriteRule ^~([a-z.]+)/api/([a-z]+)/?$ index.php?project=$1&mode=$2 [NC]

    # Paste list
    RewriteRule ^all/?$ list.php [NC]
    RewriteRule ^api/([a-z]+)/all/?$ list.php?mode=$1 [NC]
    RewriteRule ^~([a-z.]+)/all/?$ list.php?project=$1 [NC]
    RewriteRule ^~([a-z.]+)/api/([a-z]+)/all/?$ list.php?project=$1&mode=$2 [NC]
    RewriteRule ^rss/?$ list.php?rss=1 [NC]
    RewriteRule ^~([a-z.]+)/rss/?$ list.php?project=$1&rss=1 [NC]
    RewriteRule ^all/([0-9]+)/?$ list.php?page=$1 [NC]
    RewriteRule ^api/([a-z]+)/all/([0-9]+)/?$ list.php?mode=$1&page=$2 [NC]
    RewriteRule ^~([a-z.]+)/all/([0-9]+)/?$ list.php?project=$1&page=$2 [NC]
    RewriteRule ^~([a-z.]+)/api/([a-z]+)/all/([0-9]+)/?$ list.php?project=$1&mode=$2&page=$3 [NC]

    # General links
    RewriteRule ^([0-9]+)/?$ show.php?id=$1 [NC]
    RewriteRule ^~([a-z.]+)/([0-9]+)/?$ show.php?project=$1&id=$2 [NC]
    RewriteRule ^([0-9]+)/([a-z|A-Z]+)/?$ show.php?id=$1&mode=$2 [NC]
    RewriteRule ^~([a-z.]+)/([0-9]+)/([a-z|A-Z]+)/?$ show.php?project=$1&id=$2&mode=$3 [NC]
    RewriteRule ^api/([a-z|A-Z]+)/([0-9]+)/?$ show.php?mode=$1&id=$2 [NC]
    RewriteRule ^~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+)/?$ show.php?project=$1&mode=$2&id=$3 [NC]
    RewriteRule ^([0-9]+)/([0-9]+)/?$ show.php?id=$1&hash=$2 [NC]
    RewriteRule ^~([a-z.]+)/([0-9]+)/([0-9]+)/?$ show.php?project=$1&id=$2&hash=$3 [NC]
    RewriteRule ^([0-9]+)/([0-9]+)/([a-z|A-Z]+)/?$ show.php?id=$1&hash=$2&mode=$3 [NC]
    RewriteRule ^~([a-z.]+)/([0-9]+)/([0-9]+)/([a-z|A-Z]+)/?$ show.php?project=$1&id=$2&hash=$3&mode=$4 [NC]
    RewriteRule ^api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/?$ show.php?mode=$1&id=$2&hash=$3 [NC]
    RewriteRule ^~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/?$ show.php?project=$1&mode=$2&id=$3&hash=$4 [NC]
    RewriteRule ^api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/(.*)$ show.php?mode=$1&id=$2&hash=$3&password=$4 [NC]
    RewriteRule ^~([a-z.]+)/api/([a-z|A-Z]+)/([0-9]+)/([0-9]+)/(.*)$ show.php?project=$1&mode=$2&id=$3&hash=$4&password=$5 [NC]
    </IfModule>
</Directory>
