.htaccess
ExpiresActive On
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/html "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
An overview about how to speed up your website you can test it at:
https://developers.google.com/speed/pagespeed/insights/
From dan.berladyn.online
RewriteEngine On
RewriteOptions inherit
# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php7_module>
php_value error_reporting E_ALL
php_value error_log "/home/[user-account]/logs/php-errors.log"
</IfModule>
<IfModule lsapi_module>
php_value error_reporting E_ALL
php_value error_log "/home/[user-account]/logs/php-errors.log"
</IfModule>
# END cPanel-generated php ini directives, do not edit
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteCond %{HTTP_HOST} ^berladyn.online$ [OR]
RewriteCond %{HTTP_HOST} ^www.berladyn.online$
RewriteRule ^/?$ "https://berladyn.online/" [R=301,L]
RewriteCond %{HTTP_HOST} ^berladyn.online$ [OR]
RewriteCond %{HTTP_HOST} ^www.berladyn.online$
RewriteRule ^directory.php$ "https://berladyn.online/directory.php" [R=301,L]
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74†package as the default “PHP†programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
First check if mod rewrite is enabled on the server:
<IfModule mod_rewrite.c>
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_URI} !(\.png|\.jpg|\.webp|\.gif|\.jpeg|\.zip|\.css|\.svg|\.js|\.xml)$
RewriteRule (.*) routes.php [QSA,L]
<IfModule mime_module>
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# 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