AddDefaultCharset UTF-8

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*[^/])$ $1/ [L,R=301]

RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ https://%1/$1 [L,R=301]

#RewriteCond %{REQUEST_URI} !^/robots.txt$ [NC]
#RewriteCond %{REQUEST_URI} !^/sitemap.xml$ [NC]
#RewriteCond %{REQUEST_URI} !^/yandex_put.php$ [NC]
#RewriteCond %{REQUEST_URI} !^/map_generate.php$ [NC]
#RewriteCond %{REQUEST_URI} !^/add_pars.php$ [NC]
#RewriteCond %{REQUEST_URI} !^/cached_clean.php$ [NC]

#RewriteCond %{HTTPS} off
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteRule ^play/(.*)$ play.php?f=$1 [L,QSA]
RewriteRule ^page/([0-9]+)/$ index.php?page=$1 [L,QSA]
RewriteRule ^song/([0-9]+)/(.*)/$ song.php?id=$1&name=$2 [L,QSA]
RewriteRule ^artist/([0-9]+)/(.*)/([0-9]+)/$ artist.php?id=$1&name=$2&page=$3 [L,QSA]
RewriteRule ^artist/([0-9]+)/(.*)/$ artist.php?id=$1&name=$2 [L,QSA]
RewriteRule ^artist-all/$ artist-all.php [L,QSA]
RewriteRule ^artist-all/([0-9]+)/$ artist-all.php?page=$1 [L,QSA]
RewriteRule ^genre/([0-9]+)/(.*)/([0-9]+)/$ genre.php?id=$1&name=$2&page=$3 [L,QSA]
RewriteRule ^genre/([0-9]+)/(.*)/$ genre.php?id=$1&name=$2 [L,QSA]
RewriteRule ^song-list/(.*)/([0-9]+)/$ song-list.php?name=$1&page=$2 [L,QSA]
RewriteRule ^song-list/(.*)/$ song-list.php?name=$1 [L,QSA]
RewriteRule ^collections/$ collections.php [L,QSA]
RewriteRule ^collections/([0-9]+)/$ collections.php?page=$1 [L,QSA]
RewriteRule ^collections_view/([0-9]+)/(.*)/([0-9]+)/$ collections_view.php?id=$1&name=$2&page=$3 [L,QSA]
RewriteRule ^collections_view/([0-9]+)/(.*)/$ collections_view.php?id=$1&name=$2 [L,QSA]
RewriteRule ^genre-list/$ genre-list.php [L,QSA]
RewriteRule ^genre-list/([0-9]+)/$ genre-list.php?page=$1 [L,QSA]
RewriteRule ^album/$ album.php [L,QSA]
RewriteRule ^album/([0-9]+)/$ album.php?page=$1 [L,QSA]
RewriteRule ^album_view/([0-9]+)/(.*)/([0-9]+)/$ album_view.php?id=$1&name=$2&page=$3 [L,QSA]
RewriteRule ^album_view/([0-9]+)/(.*)/$ album_view.php?id=$1&name=$2 [L,QSA]
RewriteRule ^singer-artist/(.*)/([0-9]+)/$ singer-artist.php?name=$1&page=$2 [L,QSA]
RewriteRule ^singer-artist/(.*)/$ singer-artist.php?name=$1 [L,QSA]
RewriteRule ^singer-song/(.*)/([0-9]+)/$ singer-song.php?name=$1&page=$2 [L,QSA]
RewriteRule ^singer-song/(.*)/$ singer-song.php?name=$1 [L,QSA]
RewriteRule ^dmca/$ dmca.php [L,QSA]
RewriteRule ^feedback/$ feedback.php [L,QSA]

ErrorDocument 404 /404.php

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
