Forum Moderators: phranque
#Gzip
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
#End Gzip
#cache html and htm files for one day
<FilesMatch "\.html?$">
Header set Cache-Control "max-age=43200"
</FilesMatch>
#cache css, javascript and text files for one week
<FilesMatch "\.(js|css|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>
#cache flash and images for one month
<FilesMatch "\.(flv|swf|ico|gif|jpe?g|png)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>
#disable cache for script files
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
RewriteEngine on
RewriteCond %{THE_REQUEST} \.php
RewriteRule ^blog/([^.]+)\.php$ https://www.example.com/blog/$1/ [R=301,L]
RewriteRule ^blog/([^.]+[^./])$ https://www.example.com/blog/$1/ [R=301,L]
RewriteCond %{REQUEST_URI} ^/((?:[\w-]/)*)index\.htm
RewriteRule index\.htm https://www.example.com/%1 [R=301,L,NS]
RewriteCond %{REQUEST_URI} ^/([\w-]+/)blog/index\.php
RewriteRule /blog/index\.php$ https://www.example.com/%1 [R=301,L,NS]
#Redirect old affs
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
# rewrite after redirects
RewriteRule ^(blog/[^.]+)/$ /$1.php [L]
# 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_flag display_errors Off
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 128M
php_value post_max_size 16M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php70"
php_value upload_max_filesize 2M
php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
php_flag display_errors Off
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 128M
php_value post_max_size 16M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php70"
php_value upload_max_filesize 2M
php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php70” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php70 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
ErrorDocument 404 /404.html or whatever file you want to use to respond to the 404 error in there somewhere to tell the server what URL to serve for a 404 error. if ($done == 0)
{
ob_end_clean();
if ($realpage == 0)
{
if (function_exists('http_response_code'))
{ http_response_code(404); }
else
{ header($_SERVER['SERVER_PROTOCOL'] . " 404 Not Found"); }
include ($_SERVER['DOCUMENT_ROOT'] . "/boilerplate/missing.html");
}
}Edit out the parts that don’t apply; I think you can figure out what my variable-names meant. My version involved an output buffer, hence the ob_end_clean. But there should definitely be something analogous to the last two lines. [edited by: engine at 6:58 am (utc) on May 8, 2024]
[edit reason] Edit requested by poster [/edit]