Nirjonadda

Well-Known Member
May 8, 2013
736
27
78
cPanel Access Level
Root Administrator
Please can you let me know that why Expires header are not updated instantly with current date? This showing Expires: Thu, 19 Nov 1981

ScreenShot01282.png
Code:
RewriteEngine On

# Redirect www to non-www from HTTP to HTTPS
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]

# HTTP Authentication with cgi/fastCGI
RewriteCond %{HTTP:Authorization} .+
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# AutoSSL validation required HTTP redirects
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$

# SVG Support
RewriteRule ^data/svg/([^/]+)/([^/]+)/([^/]+)/([^\.]+).svg$ svg.php?svg=$4&s=$1&l=$2&d=$3 [B,NC,L,QSA]

# Prevent viewing of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>

# Block An IP Address
Order Allow,Deny
Allow from all
Deny from 182.160.128.0/18

#    Mod_security can interfere with uploading of content such as attachments. If you
#    cannot attach files, remove the "#" from the lines below.
<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>

ErrorDocument 401 default
ErrorDocument 403 default
ErrorDocument 404 default
ErrorDocument 405 default
ErrorDocument 406 default
ErrorDocument 500 default
ErrorDocument 501 default
ErrorDocument 503 default

<IfModule mod_rewrite.c>
    RewriteEngine On

    #    If you are having problems with the rewrite rules, remove the "#" from the
    #    line that begins "RewriteBase" below. You will also have to change the path
    #    of the rewrite to reflect the path to your XenForo installation.
    #RewriteBase /xenforo

    #    This line may be needed to enable WebDAV editing with PHP as a CGI.
    #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
</IfModule>

AuthName "public_html"
AuthUserFile "/home/nadda/.htpasswds/public_html/passwd"

# 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 600
   php_value max_input_time 3600
   php_value max_input_vars 100000
   php_value memory_limit 1024M
   php_value post_max_size 32M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php73"
   php_value upload_max_filesize 16M
   php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
   php_flag display_errors Off
   php_value max_execution_time 600
   php_value max_input_time 3600
   php_value max_input_vars 100000
   php_value memory_limit 1024M
   php_value post_max_size 32M
   php_value session.gc_maxlifetime 1440
   php_value session.save_path "/var/cpanel/php/sessions/ea-php73"
   php_value upload_max_filesize 16M
   php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.net/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://mysite.net$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.net/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.net$      [NC]
RewriteCond %{HTTP_REFERER} !^https://mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://mysite.net/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://mysite.net$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.mysite.net/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.mysite.net$      [NC]
RewriteCond %{HTTP_REFERER} !^http://image.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://image.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.image.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.image.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://image.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://image.mysite.com$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.image.mysite.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^https://www.image.mysite.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
I am using this code in .htaccess
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,269
313
Houston
Hello,

I don't see that you've set the Expires headers in here. The documentation on the expires_module provides some further information on use and examples of syntax here" mod_expires - Apache HTTP Server Version 2.4
 

kadrin

Active Member
Nov 13, 2019
34
6
8
Italy
cPanel Access Level
Website Owner
Set expire header with the mod_expires
Code:
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
 

Nirjonadda

Well-Known Member
May 8, 2013
736
27
78
cPanel Access Level
Root Administrator
I don't see that you've set the Expires headers in here.
Yes before we have this code below but now removed for Expires header update instantly with current date. If we are not added any expires_module code in .htaccess then how this showing this date Expires: Thu, 19 Nov 1981? and where this date used?

Code:
## EXPIRES CACHING/CACHE-CONTROL ##
<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType text/html "access plus 3 days"
    ExpiresByType text/xml "access plus 1 seconds"
    ExpiresByType text/plain "access plus 1 seconds"
    ExpiresByType application/xml "access plus 1 seconds"
    ExpiresByType application/rss+xml "access plus 1 seconds"
    ExpiresByType application/json "access plus 1 seconds"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType text/javascript "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresByType application/x-javascript "access plus 1 week"
    ExpiresByType image/x-ico "access plus 1 year"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresByType application/pdf "access plus 1 month"
  <IfModule mod_headers.c>
       Header unset ETag
       Header unset Pragma
       Header unset Last-Modified
       Header append Cache-Control "public, no-transform, must-revalidate"
       #Header set Last-modified "Tue, 1 Oct 2018 10:10:10 GMT"
  </IfModule>
</IfModule>
## EXPIRES CACHING/CACHE-CONTROL ##
 

quietFinn

Well-Known Member
Feb 4, 2006
1,286
119
193
Finland
cPanel Access Level
Root Administrator
Yes before we have this code below but now removed for Expires header update instantly with current date. If we are not added any expires_module code in .htaccess then how this showing this date Expires: Thu, 19 Nov 1981? and where this date used?
See here: