#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
HostnameLookups off
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#

AddDefaultCharset utf-8
php_flag magic_quotes_runtime Off
php_flag magic_quotes_gpc Off

php_value date.timezone "Asia/Vladivostok"

#php_value mbstring.internal_encoding "UTF-8"
#php_value mbstring.func_overload 2

#php_value mbstring.encoding_translation 0
#php_value mbstring.http_input "pass"
#php_value mbstring.http_output "pass"
#php_value mbstring.internal_encoding "UTF-8"
#php_value mbstring.func_overload 7

#php_value mbstring.detect_order "auto"
#php_flag mbstring.encoding_translation On

#php_value mbstring.language "Russian"
#php_value mbstring.http_input "UTF-8"
#php_value mbstring.http_output "UTF-8"

#php_flag output_buffering On
#php_value output_handler mb_output_handler

#phpbb values:
#php_value mbstring.func_overload 4
#php_value mbstring.encoding_translation 0
#php_value mbstring.http_input "pass"
#php_value mbstring.http_output "pass"

<VirtualHost *:80>
	DocumentRoot "d:/server/root/vladnews.ru"
	ServerName localhost
	ServerAlias vladnews.ru

	ErrorLog "d:/server/logs/httpd.vladnews.ru.error.log"
	CustomLog "|bin/rotatelogs d:/server/logs/httpd.vladnews.ru.%Y%m%d.txt 86400" common
	CustomLog "d:/server/logs/httpd.vladnews.ru.referer.log" "%t \"%r\" %{Referer}i"

	<FilesMatch "(config|common)\.php$">
		Order Allow,Deny
		Deny from All
	</FilesMatch>

	<Directory "d:/server/root/vladnews.ru/openx">
		php_flag register_argc_argv On
	</Directory>

	<Directory "d:/server/root/vladnews.ru/misc/s">
		Options +Indexes
		AuthType Basic
		AuthName "707****"
		AuthUserFile  D:/server/.htpasswd
		require user splash
	</Directory>

#	<Directory "d:/server/root/vladnews.ru/101">
#		AuthType Basic
#		AuthName "707****"
#		AuthUserFile  D:/server/.htpasswd
#		require user demo
		php_value upload_max_filesize 50M
		php_value post_max_size 50M
#	</Directory>

	RewriteEngine On
#	RewriteLog "d:/server/logs/rewrite.vladnews.ru.log"
#	RewriteLogLevel 9

		#редирект на старую версию
		RewriteCond %{REQUEST_FILENAME} (archive|magazin)\.php$ [NC]
		RewriteRule (.*) http://old.vladnews.ru/%1.php [QSA,R=301,L,NC]

		RewriteCond %{QUERY_STRING} current_magazin=([0-9]+)$
		RewriteRule (.*) http://old.vladnews.ru/ [QSA,R=301,L,NC]

		RewriteCond %{REQUEST_URI} ^/(img/photos/.*)
		RewriteRule (.*) http://old.vladnews.ru/%1 [R=301,L]

		RewriteCond %{REQUEST_URI} ^/(img/.*)
		RewriteRule (.*) http://old.vladnews.ru/%1 [R=301,L]

#read
RewriteCond %{REQUEST_URI} !^/?101/?
RewriteRule ^/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)\.html?$ /read.php?y=$1&m=$2&d=$3&id=$4 [L]
#list
RewriteCond %{REQUEST_URI} !^/?101/?
RewriteRule ^/([0-9]+)(/([0-9]+))?(/([0-9]+))?/index\.html?$ /list.php?y=$1&m=$3&d=$5 [L]
#theme
RewriteRule ^/themes/?(index\.html?)?$ /themes.php [L]
RewriteRule ^/themes/([0-9]+)(\-([0-9]+))?\.html?$ /themes.php?id=$1&page=$3 [L]

#gallery
RewriteRule ^/gallery\.html?$ /gotolatestalbum.php [L]
RewriteRule ^/gallery/([0-9]+)\.html?$ /album.php?id=$1 [L]

#polls
RewriteRule ^/polls\.html?$ /polls.php [L]
RewriteRule ^/polls/([0-9]+)\.html?$ /polls.php?id=$1 [L]

#ask
RewriteRule ^/ask/([0-9]+)\.html?$ /ask.php?id=$1 [L]


	RewriteCond %{REQUEST_URI} !^/(forums|x|pma|plan|misc|publications|101)
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_FILENAME} !-f

	RewriteRule ^/arch(/([0-9]{4}))?/?$ /#newspaper/arch.php?y=$2 [L]

	RewriteCond %{REQUEST_URI} !^/?101/?
	RewriteRule ^/([0-9]+)/(views|level|cats)/?$ /#newspaper/index.php?number=$1&order=$2 [L]

	RewriteCond %{REQUEST_URI} !^/?101/?
	RewriteRule ^/([0-9]+)(/([^/]+))?/?$ /#newspaper/index.php?number=$1&c_uri=$3 [L]

	RewriteCond %{REQUEST_URI} !^/?101/?
	RewriteRule ^/([0-9]+)/([^/]+)/([^/]+)/?$ /#newspaper/read.php?number=$1&c_uri=$2&uri=$3 [L]

	RewriteRule ^/i/([0-9]+)/?$ /#newspaper/about.php?person=$1 [L]
	RewriteRule ^/about/?$ /#newspaper/about.php [L]

	RewriteRule ^/go/([0-9]+)/?$ /go.php?id=$1 [L]
	RewriteRule ^/p/([^/]+)/?$ /page.php?p=$1 [L]

#	RewriteCond %{REQUEST_URI} !^/(forums|x|pma|plan|misc|publications|101)
#	RewriteCond %{REQUEST_FILENAME} !-d
#	RewriteCond %{REQUEST_FILENAME} !-f
#	RewriteRule ^/([a-z]+)/?$ /$1.php [NC,L]
</VirtualHost>

<VirtualHost *:80>
	DocumentRoot "d:/server/root/lenta.vladnews.ru"
	ServerName lenta.vladnews.ru
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^/([0-9]+)/?$ /index.php?cat_id=$1 [L]
RewriteRule ^/([0-9]+)/([0-9]+)\.html?$ /read.php?cat_id=$1&text_id=$2 [L]
</VirtualHost>

#<VirtualHost 212.107.192.75:80>
#	DocumentRoot "d:/server/root/vladnews.tv"
#	ServerName vladnews.tv
#	RewriteEngine On
#</VirtualHost>

<VirtualHost *:80>
	DocumentRoot "d:/server/root/i.vladnews.ru"
	ServerName i.vladnews.ru

	RewriteEngine On
#	RewriteLog "d:/server/logs/rewrite.i.vladnews.ru.log"
#	RewriteLogLevel 9

#	RewriteRule ^bbb/([0-9]+)/?$ bbb.php?id=$1 [L]
	RewriteRule ^/([0-9]+)/?$ /img.php?id=$1 [L]
</VirtualHost>

#<VirtualHost *:80>
#	DocumentRoot "d:/server/root/vladnews.info"
#	ServerName vladnews.info
#	<Directory "d:/server/root/vladnews.info">
#		AuthType Basic
#		AuthName "707****"
#		AuthUserFile  D:/server/.htpasswd
#		require user demo
#	</Directory>
#</VirtualHost>


<VirtualHost *:80>
	ServerName old.vladnews.ru
	ServerAlias www.old
	DocumentRoot "d:/server/old/vladnews.ru"
	CustomLog "d:/server/logs/httpd.old.vladnews.ru.access.log" common

	<Directory "d:/server/old/vladnews.ru">
	Order allow,deny
	Allow from all

	php_flag session.use_trans_sid 0
	php_flag short_open_tag On
	php_flag register_globals On
	AddType application/x-httpd-php .php .htm .html
	#AddDefaultCharset windows-1251

	php_value auto_prepend_file "d:/server/old/9774040656d3414d26f606ad32c5a825/sape.php"
	php_value auto_append_file "d:/server/old/9774040656d3414d26f606ad32c5a825/lnx.php"
	php_flag allow_call_time_pass_reference on
	</Directory>
</VirtualHost>
<VirtualHost 212.107.192.75:80>
	DocumentRoot "d:/server/root/avecms"
	ServerName avecms.vladnews.ru
	<Directory "d:/server/root/avecms">
		
	</Directory>
AddDefaultCharset windows-1251
</VirtualHost>
<VirtualHost *:80>
	ServerName vn.vladnews.ru
	DocumentRoot "d:/server/root/vn.vladnews.ru"

	ErrorLog "d:/server/logs/httpd.vn.vladnews.ru.error.log"
	CustomLog "d:/server/logs/httpd.vn.vladnews.ru.access.log" common

	RewriteEngine On

	<Directory "d:/server/root/vn.vladnews.ru/admin">
		AuthType Basic
		AuthName "Restricted Files"
		AuthUserFile d:/server/.htpasswd
		Require user adminvlad
	</Directory>

	<Location />
	order allow,deny
	allow from all
	deny from 203.223
	deny from 58.27.208
	deny from 69.144
	deny from 68.247
	deny from 116.71
	</Location>

#php_flag session.use_trans_sid On

	RewriteRule ^/contact\.html /about.html [R=301,L]
	RewriteRule ^/(search|about)\.html /$1 [R=301,L]

	RewriteRule ^/(search|about)/?$ /html.php?page=$1 [NC,L]

	RewriteCond %{REQUEST_URI} ^/pages

	RewriteRule /pages/(china|nkorea|skorea|japan|braille|france|wildlife)([0-9]+)?.html /pages.php?id=$1&page=$2 [L]

	RewriteCond %{REQUEST_URI} !^/(pages)
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_FILENAME} !-f
#done
	RewriteRule ^/issue([0-9]+)(/([^\/]+)(/([0-9]+))?)?/?$ /index.php?i=$1&c=$3&page=$5 [L]
	RewriteRule ^/issue([0-9]+)/([^\/]+)/([^\/]+)(/([0-9]+))?/?$ /read.php?i=$1&c=$2&t=$3&page=$5 [L]
#	RewriteRule ^issue([0-9]+)/([^\/]+)/([^\/]+)/rss$ comments.php?i=$1&c=$2&t=$3 [L]

	RewriteRule ^/archive(/([0-9]{4}))?/?$ /archive.php?y=$2 [L]

	RewriteRule ^/(tree|photo)(/([^\/]+)(/([0-9]+))?)?/?$ /$1.php?c=$3&page=$5 [L]

	RewriteRule ^/gb(/([a-z]+)(/([0-9]+))?)?/?$ /gb.php?type=$2&page=$4 [L]
</VirtualHost>
