##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
##

# *** kunmans - May 6th, 2015 - start *****
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# *** kunmans - May 6th, 2015 - end *****

## *** kunmans *** turn off magic quotes gpc
#php_flag magic_quotes_gpc off

<IfModule mod_suphp.c>
  suPHP_ConfigPath /home/indiael1/public_html/printablecoloringpages.in
  <Files php.ini>
    order allow,deny
    deny from all
  </Files>
</IfModule>


## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects

##
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##


Options +FollowSymLinks
RewriteEngine On
RewriteBase /

## *** kunmans *** below code is to prevent access to website through subdomain
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTP_HOST} rokkada.com$
RewriteRule ^(.*)$ https://colouring-pages\.co\.uk/$1 [R=301,L]

</IfModule>

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
## END - *** kunmans *** below code is to prevent access to website through subdomain

#RewriteCond %{HTTPS} off
#RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]

# this is if url contains /coloring/
RewriteRule ^colouring/(.*) ./index.php?s=$1

# this is for non search urls like category pages
RewriteRule ^(.*)colouring-pages(.*)$ ./index.php?p=$1colouring-pages

RewriteRule ^privacy-policy(.*)$ ./index.php?p=privacy-policy

ErrorDocument 404 /index.php?p=404

# for spam & bad bot control - kunmans
SetEnvIfNoCase Via evil-spam-proxy spammer=yes
SetEnvIfNoCase Referer evil-spam-domain.com spammer=yes
SetEnvIfNoCase Referer evil-spam-keyword spammer=yes
SetEnvIfNoCase Via pinappleproxy spammer=yes
SetEnvIfNoCase Referer semalt.com spammer=yes
SetEnvIfNoCase Referer poker spammer=yes
SetEnvIfNoCase Referer darodar.com spammer=yes
SetEnvIfNoCase Referer buttons-for-website.com spammer=yes
SetEnvIfNoCase Referer vi-view.com  spammer=yes

SetEnvIfNoCase User-Agent "^magpie-crawler" bad_bot
SetEnvIfNoCase User-Agent "^baiduspider" bad_bot
SetEnvIfNoCase User-Agent "^baidu" bad_bot
SetEnvIfNoCase User-Agent "^baidu.*" bad_bot
SetEnvIfNoCase User-Agent "^Baiduspider/2.0" bad_bot
SetEnvIfNoCase User-Agent "^Yandex.*" bad_bot
SetEnvIfNoCase User-Agent "^YandexBot" bad_bot
SetEnvIfNoCase User-Agent "^AhrefsBot" bad_bot
SetEnvIfNoCase User-Agent "^MJ12bot" bad_bot
SetEnvIfNoCase User-Agent "^proximic" bad_bot

Order allow,deny
Allow from all
Deny from env=spammer
Deny from env=bad_bot