DirectoryIndex index.php

RewriteEngine On

# Отключаем вывод ошибок пользователям
	php_flag display_errors off

# Страница получения витжета
   RewriteRule ^widget_public_create(/?)+$ index.php?go=getwidget [L]	   
	
# Регистрация
	RewriteRule ^reg/(/?)+$ index.php?go=register [L]
	
# API (beta)
	# user
	RewriteRule ^method/users.get&user_id=([0-9]+)(/?)+$ index.php?go=api&method=users.get&userid=$1 [L]
	RewriteRule ^method/users.get.xml&user_id=([0-9]+)(/?)+$ index.php?go=api&method=users.get.xml&userid=$1 [L]
	# wall
	RewriteRule ^method/wall.post&owner_id=([0-9]+)&message=([a-z,A-Z,0-9,_@.]+)&app_id=([0-9]+)&app_secret=([a-zA-Z0-9]+)(/?)+$ index.php?go=api&method=wall.post&owner_id=$1&message=$2&app_id=$3&app_secret=$4 [L]
	# utils
	RewriteRule ^method/utils.getServerTime(/?)+$ index.php?go=api&method=utils.getServerTime [L]
	# status
	RewriteRule ^method/status.get&user_id=([0-9]+)(/?)+$ index.php?go=api&method=status.get&userid=$1 [L]
	RewriteRule ^method/status.set&text=([a-z,A-Z,0-9,_,!.]+)(/?)+$ index.php?go=api&method=status.set&text=$1 [L]
	# likes
	RewriteRule ^method/likes.isLiked&user_id=([0-9]+)&type=([a-z]+)&item_id=([0-9]+)(/?)+$ index.php?go=api&method=likes.isLiked&userid=$1&type=$2&item_id=$3 [L]
	RewriteRule ^method/likes.add&type=([a-z]+)&owner_id=([0-9]+)&item_id=([0-9]+)(/?)+$ index.php?go=api&method=likes.add&type=$1&owner_id=$2&item_id=$3 [L]
	RewriteRule ^method/likes.delete&type=([a-z]+)&owner_id=([0-9]+)&item_id=([0-9]+)(/?)+$ index.php?go=api&method=likes.delete&type=$1&owner_id=$2&item_id=$3 [L]
	# account
	RewriteRule ^method/account.banUser&user_id=([0-9]+)(/?)+$ index.php?go=api&method=account.banUser&userid=$1 [L]
	RewriteRule ^method/account.unbanUser&user_id=([0-9]+)(/?)+$ index.php?go=api&method=account.unbanUser&userid=$1 [L]
	RewriteRule ^method/account.getProfileInfo(/?)+$ index.php?go=api&method=account.getProfileInfo [L]	

# Авторизация через социальные сети
     RewriteRule ^login+$ index.php?go=login [L]

#Команда сайта
	RewriteRule ^about(/?)+$ index.php?go=about [L]	  
	
#Помочь проекту
	RewriteRule ^donate(/?)+$ index.php?go=donate [L]	  	
	
# Отзывы
	RewriteRule ^reviews(/?)+$ index.php?go=reviews [L]
	
# Статистика страницы пользователя
	RewriteRule ^my_stats(/?)+$ index.php?go=my_stats [L]

# uLogin     
	RewriteRule ^ulogin+$ index.php?go=ulogin [L]

# Страница юзера
	RewriteRule ^u([0-9]+)(/?)+$ index.php?go=profile&id=$1 [L]
	RewriteRule ^u([0-9]+)after(/?)+$ index.php?go=profile&id=$1&after=1 [L]

# Баги
	RewriteCond %{QUERY_STRING} ^act=([a-z]+)
	RewriteRule ^(.*)bugs $1index.php?go=bugs [QSA,L]	
	RewriteCond %{QUERY_STRING} ^id=([0-9]+)
	RewriteRule ^(.*)bugs $1index.php?go=bugs [QSA,L]
	RewriteRule ^bugs(/?)+$ index.php?go=bugs [L]
	
# Редактирование страницы
	RewriteRule ^editmypage(/?)+$ index.php?go=editprofile [L]
	RewriteRule ^editmypage/contact(/?)+$ index.php?go=editprofile&act=contact [L]
	RewriteRule ^editmypage/interests(/?)+$ index.php?go=editprofile&act=interests [L]
	RewriteRule ^editmypage/all(/?)+$ index.php?go=editprofile&act=all [L]
	
# Альбомы
	RewriteRule ^albums/([0-9]+)(/?)+$ index.php?go=albums&uid=$1 [L]
	RewriteRule ^albums/add/([0-9]+)(/?)+$ index.php?go=albums&act=add&aid=$1 [L]
	RewriteRule ^albums/view/([0-9]+)(/?)+$ index.php?go=albums&act=view&aid=$1 [L]
	RewriteRule ^albums/view/([0-9]+)/page/([0-9]+)(/?)+$ index.php?go=albums&act=view&aid=$1&page=$2 [L]
	RewriteRule ^albums/comments/([0-9]+)(/?)+$ index.php?go=albums&act=all_comments&uid=$1 [L]
	RewriteRule ^albums/comments/([0-9]+)/page/([0-9]+)(/?)+$ index.php?go=albums&act=all_comments&uid=$1&page=$2 [L]
	RewriteRule ^albums/view/([0-9]+)/comments/(/?)+$ index.php?go=albums&act=all_comments&aid=$1 [L]
	RewriteRule ^albums/view/([0-9]+)/comments/page/([0-9]+)(/?)+$ index.php?go=albums&act=all_comments&aid=$1&page=$2 [L]
	RewriteRule ^albums/editphotos/([0-9]+)(/?)+$ index.php?go=albums&act=edit_pos_photos&aid=$1 [L]
	RewriteRule ^albums/newphotos(/?)+$ index.php?go=albums&act=new_photos [L]
	RewriteRule ^albums/newphotos/([0-9]+)(/?)+$ index.php?go=albums&act=new_photos&page=$1 [L]

	
# Просмотр фотографий
	RewriteRule ^photo([0-9]+)_([0-9]+)_sec=user_page(/?)+$ index.php?go=profile&id=$1 [L]
	RewriteRule ^photo([0-9]+)_([0-9]+)_sec=all_comments(/?)+$ index.php?go=albums&act=all_comments&uid=$1 [L]
	RewriteRule ^photo([0-9]+)_([0-9]+)_sec=wall/fuser=([0-9]+)(/?)+$ index.php?go=profile&id=$3 [L]
	RewriteRule ^photo([0-9]+)_([0-9]+)_sec=notes/id=([0-9]+)(/?)+$ index.php?go=notes&act=view&note_id=$3 [L]
	RewriteRule ^photo([0-9]+)_([0-9]+)_sec=news(/?)+$ index.php?go=news [L]
	RewriteRule ^photo([0-9]+)_([0-9]+)_sec=msg/id=([0-9]+)(/?)+$ index.php?go=messages&act=review&mid=$3 [L]
	RewriteRule ^photo([0-9]+)_([0-9]+)_([0-9]+)(/?)+$ index.php?go=albums&act=view&aid=$3 [L]
	RewriteRule ^photo([0-9]+)_([0-9]+)_([0-9]+)_sec=album_comments(/?)+$ index.php?go=albums&act=all_comments&aid=$3 [L]
	RewriteRule ^photo([0-9]+)_([0-9]+)_([0-9]+)_sec=newphotos(/?)+$ index.php?go=albums&act=new_photos [L]

# Друзья
	RewriteRule ^friedns/send_demand/([0-9]+)(/?)+$ index.php?go=friends&act=send_demand&for_user_id=$1 [L]
	RewriteRule ^friedns/take/([0-9]+)(/?)+$ index.php?go=friends&act=take&take_user_id=$1 [L]
	RewriteRule ^friedns/reject/([0-9]+)(/?)+$ index.php?go=friends&act=reject&reject_user_id=$1 [L]
	RewriteRule ^friends(/?)+$ index.php?go=friends [L]
	RewriteRule ^friends/([0-9]+)(/?)+$ index.php?go=friends&user_id=$1 [L]
	RewriteRule ^friends/([0-9]+)/page/([0-9]+)(/?)+$ index.php?go=friends&user_id=$1&page=$2 [L]
	RewriteRule ^friends/online/([0-9]+)(/?)+$ index.php?go=friends&act=online&user_id=$1 [L]
	RewriteRule ^friends/online/([0-9]+)/page/([0-9]+)(/?)+$ index.php?go=friends&act=online&user_id=$1&page=$2 [L]
	RewriteRule ^friends/requests(/?)+$ index.php?go=friends&act=requests [L]
	RewriteRule ^friends/requests/page/([0-9]+)(/?)+$ index.php?go=friends&act=requests&page=$1 [L]
	RewriteRule ^friends/common/([0-9]+)(/?)+$ index.php?go=friends&act=common&uid=$1 [L]
	RewriteRule ^friends/common/([0-9]+)/page/([0-9]+)(/?)+$ index.php?go=friends&act=common&uid=$1&page=$2 [L]
	
# Закладки
	RewriteRule ^fave(/?)+$ index.php?go=fave [L]
	RewriteRule ^fave/page/([0-9]+)(/?)+$ index.php?go=fave&page=$1 [L]	

# Заметки
	RewriteRule ^notes(/?)+$ index.php?go=notes [L]
	RewriteRule ^notes/add(/?)+$ index.php?go=notes&act=add [L]
	RewriteRule ^notes/edit/([0-9]+)(/?)+$ index.php?go=notes&act=edit&note_id=$1 [L]
	RewriteRule ^notes/view/([0-9]+)(/?)+$ index.php?go=notes&act=view&note_id=$1 [L]
	RewriteRule ^notes/([0-9]+)(/?)+$ index.php?go=notes&get_user_id=$1 [L]
	RewriteRule ^notes/([0-9]+)/page/([0-9]+)(/?)+$ index.php?go=notes&get_user_id=$1&page=$2 [L]
	
# Видео
	RewriteRule ^videos(/?)+$ index.php?go=videos [L]
	RewriteRule ^videos/([0-9]+)(/?)+$ index.php?go=videos&get_user_id=$1 [L]
	RewriteRule ^videos/([0-9]+)/page/([0-9]+)(/?)+$ index.php?go=videos&get_user_id=$1&page=$2 [L]
	RewriteRule ^videos/([0-9]+)(/?)+$ index.php?go=videos&get_user_id=$1 [L]
	RewriteRule ^video([0-9]+)_([0-9]+)(/?)+$ index.php?go=videos&get_user_id=$1 [L]
	RewriteRule ^video([0-9]+)_([0-9]+)_sec=wall/fuser=([0-9]+)(/?)+$ index.php?go=profile&id=$3 [L]
	RewriteRule ^video([0-9]+)_([0-9]+)_sec=notes/id=([0-9]+)(/?)+$ index.php?go=notes&act=view&note_id=$3 [L]
	RewriteRule ^video([0-9]+)_([0-9]+)_sec=news(/?)+$ index.php?go=news [L]
	RewriteRule ^video([0-9]+)_([0-9]+)_sec=msg/id=([0-9]+)(/?)+$ index.php?go=messages&act=review&mid=$3 [L]
	
# Поиск
	RewriteRule ^search/query=(.*)&type=([0-3]+)(/?)+$ index.php?go=search&query=$1&type=$2 [L]
	
# Новости
	RewriteRule ^news(/?)+$ index.php?go=news [L]
	RewriteRule ^news/updates(/?)+$ index.php?go=news&type=updates [L]
	RewriteRule ^news/photos(/?)+$ index.php?go=news&type=photos [L]
	RewriteRule ^news/videos(/?)+$ index.php?go=news&type=videos [L]
	RewriteRule ^news/notifications(/?)+$ index.php?go=news&type=notifications [L]
	
# Сообщения
	RewriteRule ^messages(/?)+$ index.php?go=messages [L]
	RewriteRule ^messages/i(/?)+$ index.php?go=messages&info=1 [L]
	RewriteRule ^messages/outbox(/?)+$ index.php?go=messages&act=outbox [L]
	RewriteRule ^messages/show/([0-9]+)(/?)+$ index.php?go=messages&act=review&mid=$1 [L]
	
# Стена
	RewriteRule ^wall([0-9]+)(/?)+$ index.php?go=wall&uid=$1&type=page [L]
	RewriteRule ^wall([0-9]+)/page/([0-9]+)(/?)+$ index.php?go=wall&uid=$1&type=page&page=$2 [L]
	RewriteRule ^wall([0-9]+)_sec=own(/?)+$ index.php?go=wall&uid=$1&type=own [L]
	RewriteRule ^wall([0-9]+)_sec=own&page=([0-9]+)(/?)+$ index.php?go=wall&uid=$1&type=own&page=$2 [L]
	RewriteRule ^wall([0-9]+)_([0-9]+)(/?)+$ index.php?go=wall&uid=$1&rid=$2&type=record [L]
	
# Настройки
	RewriteRule ^settings(/?)+$ index.php?go=settings [L]
	RewriteRule ^settings/privacy(/?)+$ index.php?go=settings&act=privacy [L]
	RewriteRule ^settings/blacklist(/?)+$ index.php?go=settings&act=blacklist [L]
	
# Помощь
	RewriteCond %{QUERY_STRING} ^act=([a-z]+)
	RewriteRule ^(.*)support $1index.php?go=support [QSA,L]

	RewriteCond %{QUERY_STRING} ^page=([0-9]+)
	RewriteRule ^(.*)support $1index.php?go=support [QSA,L]
	RewriteRule ^support(/?)+$ index.php?go=support [L]
	
# Воостановление пароля
	RewriteCond %{QUERY_STRING} ^act=([a-z]+)
	RewriteRule ^(.*)restore $1index.php?go=restore [QSA,L]
	RewriteRule ^restore(/?)+$ index.php?go=restore [L]
	
# Блог сайта
	RewriteCond %{QUERY_STRING} ^act=([a-z]+)
	RewriteRule ^(.*)blog $1index.php?go=blog [QSA,L]
	
	RewriteCond %{QUERY_STRING} ^id=([0-9]+)
	RewriteRule ^(.*)blog $1index.php?go=blog [QSA,L]
	RewriteRule ^blog(/?)+$ index.php?go=blog [L]
	
# UBM
	RewriteCond %{QUERY_STRING} ^act=([a-z]+)
	RewriteRule ^(.*)balance $1index.php?go=balance [QSA,L]
	RewriteRule ^balance(/?)+$ index.php?go=balance [L]
	
# Реф. ссылка на регистрацию
	RewriteRule ^reg([0-9]+)(/?)+$ index.php?reg=$1 [L]
	
# Подарки
	RewriteCond %{QUERY_STRING} ^new=([0-9]+)
	RewriteRule ^(.*)gifts([0-9]+) $1index.php?go=gifts&uid=$2 [QSA,L]
	
	RewriteCond %{QUERY_STRING} ^page=([0-9]+)
	RewriteRule ^(.*)gifts([0-9]+) $1index.php?go=gifts&uid=$2 [QSA,L]
	
	RewriteRule ^gifts([0-9]+)(/?)+$ index.php?go=gifts&uid=$1 [L]

# Статистика сообщетсв
	RewriteCond %{QUERY_STRING} ^gid=([0-9]+)
	RewriteRule ^(.*)stats $1index.php?go=stats_groups [QSA,L]
	
# Сообщества
	RewriteCond %{QUERY_STRING} ^act=([a-z]+)
	RewriteRule ^(.*)groups $1index.php?go=groups [QSA,L]

	RewriteCond %{QUERY_STRING} ^page=([0-9]+)
	RewriteRule ^(.*)groups $1index.php?go=groups [QSA,L]
	RewriteRule ^groups(/?)+$ index.php?go=groups [L]
	
	RewriteRule ^wallgroups([0-9]+)_([0-9]+)(/?)+$ index.php?go=groups&act=wallgroups&pid=$1&id=$2 [L]
	
# Музыка
	RewriteRule ^audio(/?)+$ index.php?go=audio [L]
	RewriteRule ^audio([0-9]+)(/?)+$ index.php?go=audio&uid=$1 [L]

# Документы
	RewriteRule ^docs(/?)+$ index.php?go=doc&act=list [L]

# Игры
	RewriteRule ^apps(/?)+$ index.php?go=apps [L]
	RewriteRule ^app([0-9]+)(/?)+$ index.php?go=apps&act=start&id=$1 [L]
	
# Сообщества -> Публичные страницы -> Аудио
	RewriteRule ^public/audio([0-9]+)(/?)+$ index.php?go=public_audio&pid=$1 [L]

# Сообщества -> Публичные страницы -> Видео
	RewriteRule ^public/videos([0-9]+)(/?)+$ index.php?go=public_videos&pid=$1 [L]
	
# Сообщества -> Публичные страницы -> Обсуждения
	RewriteCond %{QUERY_STRING} ^act=([a-z]+)
	RewriteRule ^(.*)forum([0-9]+) $1index.php?go=groups_forum&public_id=$2 [QSA,L]

	RewriteCond %{QUERY_STRING} ^page=([0-9]+)
	RewriteRule ^(.*)forum([0-9]+) $1index.php?go=groups_forum&public_id=$2 [QSA,L]
	RewriteRule ^forum([0-9]+)(/?)+$ index.php?go=groups_forum&public_id=$1 [L]
	
# Сообщества -> Публичные страницы
	RewriteCond %{QUERY_STRING} ^act=([a-z]+)
	RewriteRule ^public([0-9]+)(/?)+$ index.php?go=public&pid=$1 [L]
	
	RewriteRule ^public([0-9]+)(/?)+$ index.php?go=public&pid=$1 [L]
	RewriteRule ^([^.]+)/?$ ?go=alias&url=$1 [L]

# Стат страницы
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteRule ^([^/]+).html$ index.php?go=static&page=$1 [L]