#ERROR
ErrorDocument 500 "HTTP Error 500 (Internal Server Error)"
ErrorDocument 400 "HTTP Error 400 (Bad Request)"
ErrorDocument 401 "HTTP Error 401 (Unauthorized)"
ErrorDocument 403 "HTTP Error 403 (Forbidden)"
ErrorDocument 404 "HTTP Error 404 (Not Found)"

#MANAGE DIR.LIST
Options -Indexes

#IGNORE THESE FILES IN DIR.LIST
IndexIgnore .. *php

#INDEX OPTIONS FOR DIR.LIST
IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble HTMLTable

#HEADER AND FOOTER FOR DIRECTORY LISTING
HeaderName /resources/header.html
ReadmeName /resources/footer.html

RewriteEngine On
RewriteOptions InheritDown

#HTTPS FOR ALL PAGES EXCEPT SOME ON BB
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP:CF-Visitor} !https
RewriteCond %{HTTP_USER_AGENT} !BlackBerry [NC]
RewriteCond %{REQUEST_URI} !^/resources/
RewriteCond %{REQUEST_URI} !^/radio/
RewriteCond %{REQUEST_URI} !^/blackberry/
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#ACCESS HTML FILES WITHOUT ENTERING .HTML IN URL
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]

#REMOVE I=1 STRING IN URL
RewriteCond %{QUERY_STRING} ^(.*)i=[^&]+(.*)$ [NC]
RewriteRule ^ %{REQUEST_URI}? [R=301,L,NE]


#OLDER RULES NOT IN USE
#-----------------REMOVE WWW. SUBDOMAIN-----------------------------
#RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
#RewriteRule ^www.kawiesh.ml/(.*)$ http://kawiesh.ml/$1 [NC, L]
#-----------------REMOVE .HTML IN URL-------------------------------
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)\.html$ /$1 [L,R=301]
#-----------------REMOVE STRING OLDER VERSION-----------------------
#RewriteCond %{QUERY_STRING} ^(.*)i=[^&]+(.*)$ [NC]
#RewriteRule ^(.*)$ /$1?%1%2 [R=301,L]
#RewriteCond %{QUERY_STRING} ^i=\d*$
#RewriteRule ^(.*)$ /$1? [R=301,L]
#-----------------REDIRECTING A PAGE--------------------------------
#Redirect 301 /zeep.html /other/zeep.html
#-----------------DISABLE HOTLINKING--------------------------------
#RewriteCond %{HTTP_REFERER} !^$
#RewriteCond %{HTTP_REFERER} !^http://(www\.)?kawiesh.cf/.*$ [NC]
#RewriteRule \.(gif|jpg|js|css)$ - [F]
#-----------------HIDE HTACCESS FILE--------------------------------
#<Files .htaccess>
#order allow,deny
#deny from all
#</Files>#ERROR