Options +FollowSymlinks
RewriteEngine on

#ErrorDocument 400 /databap/index.php?p=error
#ErrorDocument 401 /databap/index.php?p=error
#ErrorDocument 403 /databap/index.php?p=error
#ErrorDocument 404 /databap/index.php?p=error&test=%{REQUEST_URI}
#ErrorDocument 500 /databap/index.php?p=error

#reading procedure bytes (by id/phrase)
RewriteRule ^(.*)(p|proc|procedure)\-([0-9]+)$ index.php?p=procedure&proc_id=$3 [L]

#Article (by id)
RewriteRule ^(.*)(a|art|article)\-(.+)$ index.php?a=art_redirect&id=$3 [L]

#Doc (by id)
RewriteRule ^(.*)(d|doc|documentation)\-(.+)$ index.php?p=doc&doc_id=$3 [L]

#reading code bytes (by id/phrase)
RewriteRule ^(.*)(c|code)\-(.+)$ index.php?p=read_code&code=$3 [L]

#search (by phrase)
RewriteRule ^(.*)(recherche|search)\-(.+)$ index.php?p=search&search_words=$3 [L]

#Add Procedure
RewriteRule ^(.*)(add_proc|add_procedure|p\-|proc|proc\-|procedure|procedure\-)$ index.php?p=procedure [L]

#Add Code
RewriteRule ^(.*)(add_code|c\-|code|code\-)$ index.php?p=add_code [L]

#Add Doc
RewriteRule ^(.*)doc$ index.php?p=doc [L]

#Liste
RewriteRule ^(.*)liste$ index.php?p=list [L]

#Profile (by id)
RewriteRule ^(.*)(p|profil)\-(.+)$ index.php?p=profile&profile_user=$3 [L]

#Profile (current user)
RewriteRule ^(.*)(p\-|profil|profil\-)$ index.php?p=profile&profile_user= [L]

#Chat (by message id)
RewriteRule ^(.*)chat\-(.+)$ index.php?p=chat&id=$2 [L]

#Chat (current chat)
RewriteRule ^(.*)(chat|chat\-)$ index.php?p=chat [L]

#Options
RewriteRule ^(.*)options$ index.php?p=options [L]

#RSS Feed (by category)
RewriteRule ^(.*)rss\-(.+)$ index.php?p=rss&cat=$2 [L]

#RSS Feed (all)
RewriteRule ^(.*)rss$ index.php?p=rss [L]

#Eg
#prevent www.
#RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,NC,L]
#E.g RewriteRule ^(.*)\.html $1.php
#reading code bytes (by id)
#RewriteRule ^(.*)code\-([0-9]+)$ index.php?p=read_code&id_code=$2 [L]

# Jul - deny access to the .git directory
RewriteRule \.git - [F,L]
