Options +FollowSymlinks
RewriteEngine ON
RewriteBase /

#  Cache-Control
<IfModule mod_headers.c>
        Header append Cache-Control "no-store, no-cache, must-revalidate"
</IfModule>

#################################
##    .htaccess
#	<Files ".htaccess">
#	deny from all
#	</Files>
#################################

#################################
##    
##   
##  ,  
##   
##  (,  images):
#################################
	#Options All -Indexes
#################################
## , .. 
#################################
	#Options +Indexes
#################################

#################################
##   ,
##     
## ,   
##  register_globals ON
##   
#################################
	#php_flag magic_quotes_gpc Off
	#php_flag register_globals Off
#################################

#################################
##    
##    
#################################
	#ErrorDocument 400 /error.php?400
	#ErrorDocument 401 /error.php?401
	#ErrorDocument 403 /error.php?403
	#ErrorDocument 404 /error.php?404
	#ErrorDocument 500 /error.php?500
#################################
##  :
#################################
	#ErrorDocument 400 /400.php
	#ErrorDocument 401 /401.php
	#ErrorDocument 402 /402.php
	#ErrorDocument 403 /403.php
	#ErrorDocument 404 /404.php
	#ErrorDocument 500 /500.php
#################################

#################################
##  ,   
##     :
#################################
	AddType application/octet-stream .doc .mov .avi .pdf .xls .mp4 .csv
##    .rar
	AddType "application/x-rar-compressed" .rar
#################################

#################################
##  URL
#################################
<IfModule mod_rewrite.c>
#################################
## Check that you have set Options FollowSymLinks
## and right Allow
 Options +FollowSymlinks
 RewriteEngine On
 RewriteBase /
	#RewriteRule ^.htaccess$ - [F]
#################################
#	RewriteRule ^yml2con.xml$ yml2con.php
#	RewriteRule ^index.html$ index.php
#	RewriteRule ^order/([0-9]+).html$ order.php?id=$1
	#RewriteRule ^sitemap.xml$ sitemap.php
	#RewriteRule ^news.rss rss.php?dn=news [NC]
## : mypage.phtml => index.php?mypage
	#RewriteRule ^(.+)\.phtml$ index.php?$1
#################################
## www  
  RewriteCond %{REQUEST_URI} !^/robots\\.txt$ [NC]
  RewriteCond %{HTTP_HOST} !^www\\.[a-z-]+\\.[a-z]{2,6} [NC]
  RewriteCond %{HTTP_HOST} ([a-z-]+\\.[a-z]{2,6})$ [NC]
  RewriteRule ^/(.*)$ http://%1/$1 [R=301,L]
## ,   :
	#DirectoryIndex index.php index.html index.htm 
#################################
##    ?p=
##    
##   :
## yoursitename.ru/?p=xxxx,  xxxx - id .
	#RewriteCond %{REQUEST_URI} ^/([0-9]+)$
	#RewriteRule .* http://yoursitename.ru/?p=%1 [R=301,L]
##    category
##    
	#RewriteRule ^category/(.+)$ http://yoursitename.ru/$1 [R=301,L]

	#RewriteCond %{QUERY_STRING} ^from=dir$
	#RewriteRule ^(.+)?$ /%1? [R=permanent,L]
	#RewriteRule ^([a-zA-Z0-9]+)(/?)+$ /index.php [L,QSA]

## http://yoursite.ru/catalog.php?catalog.php?r=1&pr=5   http://yoursite.ru/catalog/1/5/
##	RewriteRule ^catalog/([0-9]+)/([0-9]+)/$ catalog.php?r=$1&pr=$2
##index\.php?product=widget&color=blue&size=small&texture=fuzzy&maker=widgetco
##/product/widget/blue/small/fuzzy/widgetco

#RewriteRule ^catalog/([^/]+)/([^/]+)/?$ /catalog.php?r=$1&pr=$2 [L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /catalog\.php\?r=([^&]+)&pr=([^&]+)\ HTTP/
#RewriteRule ^catalog\.php$ http://bestest.loc/catalog/%1/%2? [R=301,L]

#bestest.loc/products.php/stolb/osCsid,53b06d0d948073a931d60aff8fe8ccf
#RewriteRule ^products.php/([^/]+)/([^/]+)/?$ /catalog.php?r=$1&pr=$2 [L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /catalog\.php\?r=([^&]+)&pr=([^&]+)\ HTTP/
#RewriteRule ^catalog\.php$ http://bestest.loc/products.php/%1/%2? [R=301,L]

#RewriteRule ^filter/([^/]+)/([^/]+)/?$ /filter.php?s=$1&m=$2 [L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /filter\.php\?s=([^&]+)&m=([^&]+)\ HTTP/
#RewriteRule ^filter\.php$ http://bestest.loc/filter/%1/%2? [R=301,L]

#RewriteRule ^catalog/([^/]+)/([^/]+)/([^/]+)/?$ /catalog.php?r=$1&pr=$2&c=$3 [L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /catalog\.php\?r=([^&]+)&pr=([^&]+)&c=([^&]+)\ HTTP/
#RewriteRule ^catalog\.php$ http://bestest.loc/catalog/%1/%2/%3/ [R=301,L]

#RewriteRule ^catalog/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /catalog.php?r=$1&pr=$2&c=$3&p=$4 [L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /catalog\.php\?r=([^&]+)&pr=([^&]+)&c=([^&]+)\&p=([^&]+)\ HTTP/
#RewriteRule ^catalog\.php$ http://bestest.loc/catalog/%1/%2/%3/%4/ [R=301,L]

#RewriteRule ^catalog/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /catalog.php?r=$1&pr=$2&c=$3&ord=$4&odesc=$5 [L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /catalog\.php\?r=([^&]+)&pr=([^&]+)&c=([^&]+)&ord=([^&]+)&odesc=([^\ ]+)\ HTTP/
#RewriteRule ^catalog\.php$ http://bestest.loc/catalog/%1/%2/%3/%4/%5? [R=301,L]

#RewriteRule ^list/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /catalog.php?r=$1&pr=$2&c=$3&ord=$4&odesc=$5 [L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /list\.php\?r=([^&]+)&pr=([^&]+)&c=([^&]+)&ord=([^&]+)&odesc=([^\ ]+)\ HTTP/
#RewriteRule ^list\.php$ http://bestest.loc/catalog/%1/%2/%3/%4/%5? [R=301,L]

#RewriteRule ^detailed/([^/]+)/([^/]+)/?$ /detailed.php?link=$1&p=$2 [L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /detailed\.php\?link=([^&]+)&p=([^&]+)\ HTTP/
#RewriteRule ^detailed\.php$ http://bestest.loc/detailed/%1/%2? [R=301,L]

#RewriteRule ^articles/([^/]+)/([^/]+)/?$ /articles.php?link=$1&page=$2 [L]
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /articles\.php\?link=([^&]+)&page=([^&]+)\ HTTP/
#RewriteRule ^articles\.php$ http://bestest.loc/articles/%1/%2? [R=301,L]

##RewriteRule ^manufacturer/([^/]+)/([^/]+)/?$ /manufacturer.php?link=$1&page=$2 [L]
##RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /manufacturer\.php\?link=([^&]+)&page=([^&]+)\ HTTP/
##RewriteRule ^manufacturer\.php$ http://bestest.loc/manufacturer/%1/%2? [R=301,L]

##    URL  
#RewriteRule ^test/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /test.php?product=$1&color=$2&size=$3&texture=$4&maker=$5 [L]
#
##       URL   
#RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /test\.php\?product=([^&]+)&color=([^&]+)&size=([^&]+)&texture=([^&]+)&maker=([^\ ]+)\ HTTP/
#RewriteRule ^test\.php$ http://bestest.loc/test/%1/%2/%3/%4/%5? [R=301,L]

##  :
## : 0.0.0.0.0.0.phtml => index.php?id=0.0.0.0.0.0
	#RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ index.php?id=$1,$2,$3,$4,$5,$6

##     
## "mysubdir",  : 
	#RewriteBase /mysubdir
	#RewriteRule ^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)\.phtml$ /mysubdir/index.php?id=$1,$2,$3,$4,$5,$6
	#RewriteRule ^(.+)\.phtml$ /mysubdir/index.php?$1 
##    
##  
	#RewriteLog "/absolute/path/to/the/rewrite.log" 
## 0 = Logging disabled, 9 = highest level of logging, only for debugging 
	#RewriteLogLevel 3
##    
  RewriteCond %{HTTP_REFERER} !^$
  RewriteCond %{HTTP_REFERER} !^http://(www\\.)?bestest.loc/.*$ [NC]
  RewriteRule \\.(gif|jpg|swf|flv|png)$ http://bestest.loc [R=302,L]

</IfModule>
