AddDefaultCharset windows-1251

<IfModule mod_charset.c>
	CharsetRecodeMultipartForms Off
	CharsetSourceEnc windows-1251
</IfModule>

<IfModule mod_php4.c>
	php_flag display_errors off
	php_flag register_globals off
	php_flag magic_quotes_gpc on
	php_flag zlib.output_compression on
	php_value output_buffering 1
	php_value allow_call_time_pass_reference on
</IfModule>

<IfModule mod_php5.c>
	php_flag display_errors off
	php_flag register_globals off
	php_flag magic_quotes_gpc on
	php_flag zlib.output_compression on
	php_value output_buffering 1
	php_value allow_call_time_pass_reference on
</IfModule>

ErrorDocument 404 /index.php?action=404&data=404/

############
# SECURITY #
###########################################################

<files config.inc.php>
 Order Deny,Allow
 Deny From All
</files>

#####################
# SMART URLs PARSER #
###########################################################
Options +FollowSymLinks
RewriteEngine on
# RewriteOptions MaxRedirects=3

## skip root page
RewriteRule ^skip/([0-9]{1,15})/?$ index.php?skip=$1&data=______rootpage/skip/$1/ [NC,L]

## search
RewriteRule ^search/?$ index.php?action=search&data=search/ [NC,L]

## add entry
RewriteRule ^add/?$ index.php?action=add&data=add/ [NC,L]

## rss
RewriteRule ^rss/?$ rss/entry.xml [NC,L]
RewriteRule ^([-a-zA-Z0-9_]+)/rss/?$ rss/$1.xml [NC,L]

## exceptions
RewriteRule ^config/?$ index.php?action=config&data=config/&%{QUERY_STRING} [NC,L]
RewriteRule ^login/?$ index.php?action=login&data=login/ [NC,L]
RewriteRule ^logout/?$ index.php?action=logout&data=logout/ [NC,L]
RewriteRule ^clearcache/?$ index.php?action=clearc&data=clearcache/ [NC,L]
RewriteRule ^random/?$ index.php?action=random&data=random/ [NC,L]
RewriteRule ^ajax/?$ index.php?action=ajax&data=ajax/ [NC,L]
RewriteRule ^add/ajax/?$ index.php?action=ajax&data=ajax/ [NC,L]

## dates
RewriteRule ^([0-9]{4,4})/?$ index.php?year=$1&action=date&part=year&data=$1/ [NC,L]
RewriteRule ^([0-9]{4,4})/([0-9]{2,2})/?$ index.php?year=$1&month=$2&action=date&part=month&data=$1/$2/ [NC,L]
RewriteRule ^([0-9]{4,4})/([0-9]{1,2})/([0-9]{1,2})/?$ index.php?year=$1&month=$2&day=$3&action=date&part=day&data=$1/$2/$3/ [NC,L]

## separate entries
RewriteRule ^entry/([0-9]{1,15})(\.html)?/?$ index.php?id=$1&action=entry&data=entry/$1/ [NC,L]
RewriteRule ^entry/([0-9]{1,15})/edit/?$ index.php?id=$1&action=edit&data=entry/$1/edit/&table=update [NC,L]
RewriteRule ^entry/([0-9]{1,15})/delete/?$ index.php?id=$1&action=delete&data=entry/$1/delete/ [NC,L]
RewriteRule ^entry/([0-9]{1,15})/addcomment/?$ index.php?id=$1&action=addcom&data=entry/$1/addcomment/ [NC,L]
RewriteRule ^entry/([0-9]{1,15})/dropcomment/([0-9]{1,15})/?$ index.php?id=$1&action=dropcom&comid=$2&data=entry/$1/dropcomment/ [NC,L]
RewriteRule ^entry/([0-9]{1,15})/dropimage/?$ index.php?id=$1&action=dropim&data=entry/$1/dropimage/ [NC,L]

## separate entries with urlcache
RewriteRule ^([0-9]{4,4})/([0-9]{1,2})/([0-9]{1,2})/([-a-zA-Z0-9_]+)(\.html)?/?$ index.php?year=$1&month=$2&day=$3&action=entry&part=day&data=$1/$2/$3/$4/&getid=true&urlcache=$4 [NC,L]
RewriteRule ^([0-9]{4,4})/([0-9]{1,2})/([0-9]{1,2})/([-a-zA-Z0-9_]+)/edit/?$ index.php?year=$1&month=$2&day=$3&action=edit&data=$1/$2/$3/$4/edit/&getid=true&urlcache=$4&table=update [NC,L]
RewriteRule ^([0-9]{4,4})/([0-9]{1,2})/([0-9]{1,2})/([-a-zA-Z0-9_]+)/delete/?$ index.php?year=$1&month=$2&day=$3&action=delete&data=$1/$2/$3/$4/delete/&getid=true&urlcache=$4 [NC,L]
RewriteRule ^([0-9]{4,4})/([0-9]{1,2})/([0-9]{1,2})/([-a-zA-Z0-9_]+)/addcomment/?$ index.php?year=$1&month=$2&day=$3&action=addcom&data=$1/$2/$3/$4/addcomment/&getid=true&urlcache=$4 [NC,L]
RewriteRule ^([0-9]{4,4})/([0-9]{1,2})/([0-9]{1,2})/([-a-zA-Z0-9_]+)/dropcomment/([0-9]{1,15})/?$ index.php?year=$1&month=$2&day=$3&action=dropcom&comid=$5&data=$1/$2/$3/$4/dropcomment/&getid=true&urlcache=$4 [NC,L]
RewriteRule ^([0-9]{4,4})/([0-9]{1,2})/([0-9]{1,2})/([-a-zA-Z0-9_]+)/dropimage/?$ index.php?year=$1&month=$2&day=$3&action=dropim&data=$1/$2/$3/$4/dropimage/&getid=true&urlcache=$4 [NC,L]

## keywords
RewriteRule ^keyword/?(([-a-zA-Z0-9_]|\||\+)+)?(\.html)?/?$ index.php?keyword=$1&action=keyword&data=keyword/$1/ [NC,L]
RewriteRule ^keyword/([-a-zA-Z0-9_]+)/random/?$ index.php?keyword=$1&action=random&data=random/ [NC,L]

## files
RewriteRule ^filemanager/?$ fileManager.php [NC,L]
RewriteRule ^entry/([0-9]{1,15})/file/delete/(.*)\.([-a-zA-Z0-9_]{1,4})$ fileManager.php?action=delete&entry=$1&file=$2.$3 [NC,L]
RewriteRule ^entry/([0-9]{1,15})/file/(.*)\.([-a-zA-Z0-9_]{1,4})$ files/$1/$2.$3 [NC,L]

##images
RewriteRule ^image/([0-9]{1,15})(\.jpg)?/?$ files/$1/image.jpg [NC,L]
RewriteRule ^thumb/([0-9]{1,15})(\.jpg)?/?$ files/$1/thumb.jpg [NC,L]
RewriteRule ^entry/([0-9]{1,15})/image(\.jpg)?/?$ files/$1/image.jpg [NC,L]
RewriteRule ^entry/([0-9]{1,15})/thumb(\.jpg)?/?$ files/$1/thumb.jpg [NC,L]

## antispam rule
RewriteRule ^antispam/([0-9]{0,15})/?$ index.php?action=antispam [NC,L]

## sections
RewriteRule ^([-a-zA-Z0-9_]+)/skip/([0-9]{1,15})/?$ index.php?data=$1/skip/$2/&section=$1&action=section&skip=$2 [NC,L]
RewriteRule ^([-a-zA-Z0-9_]+)/random/?$ index.php?section=$1&action=random&data=random/ [NC,L]
RewriteRule ^([-a-zA-Z0-9_/]+)/?$ index.php?data=$1&section=$1&action=section&%{QUERY_STRING} [NC,L]
