В основном я использую следующую конструкцию:
order allow,deny allow from all Options -Indexes AddDefaultCharset utf8 php_value session.use_trans_sid 0 RewriteRule ^.htaccess$ - [F] IndexIgnore */* CharsetDisable On RewriteEngine On ########################## ## SEO RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\. RewriteRule ^(.+[^/])$ http://%{HTTP_HOST}/$1/ [L,R=301] ## ############################
########################## ## WWW RewriteCond %{HTTP_HOST} ^www\.(.*) [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] ## ############################ # если директория или файл существуют, используем их RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico|sitemap\.xml) # в противном случае перенаправляем запрос через index.php RewriteRule . index.php
########################## ## other
php_value session.gc_maxlifetime "14400" php_value auto_prepend_file "/config.php"
RewriteRule \.git - [F,L] # deny access to the top-level git repository
php_value display_errors 1 php_value display_startup_errors 1 php_value log_errors 0 php_value error_reporting 7 php_value date.timezone Europe/Moscow php_value session.cookie_domain ".domain.ru"