<IfModule mod_rewrite.c>

#	php_value upload_max_filesize 20M  
#	php_value post_max_size 20M  	 
#	php_value max_execution_time 90
#	php_value max_input_time 300 

    # Make sure directory listing is disabled
	Options +FollowSymLinks -Indexes
	# disable the Apache MultiViews directive if it is enabled on the server. It plays havoc with URL rewriting
	Options -MultiViews
	RewriteEngine on


	# NOTICE: If you get a 404 play with combinations of the following commented out lines
	#AllowOverride All
	#RewriteBase /wherever/pyro/is

	# Restrict your site to only one domain
	# !important USE ONLY ONE OPTION
	

	# Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
	#RewriteCond %{HTTPS} !=on
	#RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
	#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
	

	# Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
	#RewriteCond %{HTTPS} !=on
	#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
	#RewriteCond %{HTTP_HOST} (.+)$ [NC]
	#RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
	RewriteCond %{HTTPS} on
	RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
	RewriteCond %{HTTP_HOST} (.+)$ [NC]
	RewriteRule ^(.*)$ https://www.%1/$1 [R=301,L]
	
	RewriteCond %{REQUEST_URI} ^/home$
	RewriteRule ^(.*)$ https://%{HTTP_HOST}/ [R=301,L]
	
	RewriteCond %{SERVER_PORT} !=443
	RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]

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

	# Keep people out of codeigniter directory and Git/Mercurial data
	RedirectMatch 403 ^/(system\/cms\/cache|system\/codeigniter|\.git|\.hg).*$

	# Send request via index.php (again, not if its a real file or folder)
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	

	<IfModule mod_php5.c>
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
		RewriteRule ^(.*)$ index.php/$1 [L]
	</IfModule>

	<IfModule !mod_php5.c>
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
		RewriteRule ^(.*)$ index.php?/$1 [L]
	</IfModule>

</IfModule>

# Disable Caching
<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>


<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>
<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>
<IfModule mod_expires.c>
  ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
  ExpiresDefault                          "access plus 1 year"

# Data
  ExpiresByType text/xml                  "access plus 0 seconds"
  ExpiresByType application/xml           "access plus 0 seconds"
  ExpiresByType application/json          "access plus 0 seconds"

# Favicon (cannot be renamed)
  ExpiresByType image/x-icon              "access plus 1 year"

# Media: images, video, audio
  ExpiresByType image/gif                 "access plus 1 year"
  ExpiresByType image/png                 "access plus 1 year"
  ExpiresByType image/jpeg                "access plus 1 year"
  ExpiresByType video/ogg                 "access plus 1 year"
  ExpiresByType audio/ogg                 "access plus 1 year"
  ExpiresByType video/mp4                 "access plus 1 year"
  ExpiresByType video/webm                "access plus 1 year"

# Webfonts
  ExpiresByType application/x-font-ttf    "access plus 1 year"
  ExpiresByType font/opentype             "access plus 1 year"
  ExpiresByType application/x-font-woff   "access plus 1 year"
  ExpiresByType image/svg+xml             "access plus 1 year"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 year"

# CSS and JavaScript
  ExpiresByType text/css                  "access plus 1 year"
  ExpiresByType application/javascript    "access plus 1 year"

</IfModule>

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
