# secure htaccess file
<Files .htaccess>
 order allow,deny
 deny from all
</Files>

# Limit bandwidth consumption
<ifmodule mod_php5.c>
php_value zlib.output_compression 16386
</ifmodule>

RewriteEngine On
RewriteCond %{REQUEST_URI} !\.php$ [NC]
RewriteCond %{REQUEST_URI} [^/]$
RewriteRule ^([^\.]+)$ $1.php [NC,L]


ErrorDocument 400 "<style type='text/css'> body{font-family: sans-serif; background: #fff; } .error_page_btn{display: inline-block; background: whitesmoke; padding: 8px; border-radius: 3px; color: #6b6b6b; text-decoration: none; box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.05); transition: background 0.1s , color 0.1s; } .error_page_btn:hover, .error_page_btn:focus{ background: #4a708e; color: #fff; text-decoration: none; } .error_div{ padding: 15px; max-width: 800px; color: #383838; box-shadow: none; border: 1px solid rgba(169, 169, 169, 0.36); } </style> <div align='center' style='margin-top: 150px;margin-bottom: 150px;'> <div class='post error_div' align='center'> <h1><span class='fa fa-exclamation-triangle' style='color: gold;'></span> 400 Bad Request - Invalid URL</h1> <br> <a href='javascript:history.back()' class='error_page_btn'>Back to a previous page</a> </div></div>"

ErrorDocument 401 "<style type='text/css'> body{font-family: sans-serif; background: #fff; } .error_page_btn{display: inline-block; background: whitesmoke; padding: 8px; border-radius: 3px; color: #6b6b6b; text-decoration: none; box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.05); transition: background 0.1s , color 0.1s; } .error_page_btn:hover, .error_page_btn:focus{ background: #4a708e; color: #fff; text-decoration: none; } .error_div{ padding: 15px; max-width: 800px; color: #383838; box-shadow: none; border: 1px solid rgba(169, 169, 169, 0.36); } </style> <div align='center' style='margin-top: 150px;margin-bottom: 150px;'> <div class='post error_div' align='center'> <h1><span class='fa fa-exclamation-triangle' style='color: gold;'></span> 401 Not Authorized</h1> <h3>The requested resource requires user authentication</h3><br> <a href='javascript:history.back()' class='error_page_btn'>Back to a previous page</a> </div></div>"

ErrorDocument 403 "<style type='text/css'> body{font-family: sans-serif; background: #fff; } .error_page_btn{display: inline-block; background: whitesmoke; padding: 8px; border-radius: 3px; color: #6b6b6b; text-decoration: none; box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.05); transition: background 0.1s , color 0.1s; } .error_page_btn:hover, .error_page_btn:focus{ background: #4a708e; color: #fff; text-decoration: none; } .error_div{ padding: 15px; max-width: 800px; color: #383838; box-shadow: none; border: 1px solid rgba(169, 169, 169, 0.36); } </style> <div align='center' style='margin-top: 150px;margin-bottom: 150px;'> <div class='post error_div' align='center'> <h1><span class='fa fa-exclamation-triangle' style='color: gold;'></span> 403 Forbidden</h1> <h3>Sorry ,But you do not have permission to access this page</h3><br> <a href='javascript:history.back()' class='error_page_btn'>Back to a previous page</a> </div></div>"

ErrorDocument 404 "<style type='text/css'> body{font-family: sans-serif; background: #fff; } .error_page_btn{display: inline-block; background: whitesmoke; padding: 8px; border-radius: 3px; color: #6b6b6b; text-decoration: none; box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.05); transition: background 0.1s , color 0.1s; } .error_page_btn:hover, .error_page_btn:focus{ background: #4a708e; color: #fff; text-decoration: none; } .error_div{ padding: 15px; max-width: 800px; color: #383838; box-shadow: none; border: 1px solid rgba(169, 169, 169, 0.36); } </style> <div align='center' style='margin-top: 150px;margin-bottom: 150px;'> <div class='post error_div' align='center'> <h1><span class='fa fa-exclamation-triangle' style='color: gold;'></span> 404 Page Not Found</h1> <h3>Sorry this page may have been removed, or that page doesn't exist!</h3><br> <a href='javascript:history.back()' class='error_page_btn'>Back to a previous page</a> </div></div>"

ErrorDocument 500 "<style type='text/css'> body{font-family: sans-serif; background: #fff; } .error_page_btn{display: inline-block; background: whitesmoke; padding: 8px; border-radius: 3px; color: #6b6b6b; text-decoration: none; box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.05); transition: background 0.1s , color 0.1s; } .error_page_btn:hover, .error_page_btn:focus{ background: #4a708e; color: #fff; text-decoration: none; } .error_div{ padding: 15px; max-width: 800px; color: #383838; box-shadow: none; border: 1px solid rgba(169, 169, 169, 0.36); } </style> <div align='center' style='margin-top: 150px;margin-bottom: 150px;'> <div class='post error_div' align='center'> <h1><span class='fa fa-exclamation-triangle' style='color: gold;'></span> 500 Internal Server</h1> <h3>Sorry ,There is a problem with the resource you are looking for,<br>And it cannot be displayed</h3><br> <a href='javascript:history.back()' class='error_page_btn'>Back to a previous page</a> </div></div>"


<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

# Secure php.ini and .htaccess
RewriteRule ^(php\\.ini|\\.htaccess) - [NC,F]

#Enable PHP short open tags
php_value short_open_tag 1
