1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

.htaccess and leverage browser caching for SEO

Discussion in 'Search Engine Optimization' started by cm2010, Jun 22, 2017.

  1. #1
    We are trying to increase website speed on one of our sites, but the codes we are entering in .htaccess it gives "error500", can anyone suggest? We tried few:

    1)
    <IfModule mod_expires.c>
    # Enable expirations
    ExpiresActive On
    # Default directive
    ExpiresDefault "access plus 1 month"
    # My favicon
    ExpiresByType image/x-icon "access plus 1 year”
    # Images
    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"
    # CSS
    ExpiresByType text/css "access plus 1 month”
    # Javascript
    ExpiresByType application/javascript "access plus 1 year"
    </IfModule>

    2)
    # BEGIN Compress text files
    <ifModule mod_deflate.c>
    <filesMatch "\.(css|js|x?html?|php)$">
    SetOutputFilter DEFLATE
    </filesMatch>
    </ifModule>
    # END Compress text files

    # BEGIN Expire headers
    <ifModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 seconds"
    ExpiresByType image/x-icon "access plus 2592000 seconds"
    ExpiresByType image/jpeg "access plus 2592000 seconds"
    ExpiresByType image/png "access plus 2592000 seconds"
    ExpiresByType image/gif "access plus 2592000 seconds"
    ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
    ExpiresByType text/css "access plus 604800 seconds"
    ExpiresByType text/javascript "access plus 216000 seconds"
    ExpiresByType application/javascript "access plus 216000 seconds"
    ExpiresByType application/x-javascript "access plus 216000 seconds"
    ExpiresByType text/html "access plus 600 seconds"
    ExpiresByType application/xhtml+xml "access plus 600 seconds"
    </ifModule>
    # END Expire headers

    # BEGIN Cache-Control Headers
    <ifModule mod_headers.c>
    <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
    Header set Cache-Control "max-age=2592000, public"
    </filesMatch>
    <filesMatch "\.(css)$">
    Header set Cache-Control "max-age=604800, public"
    </filesMatch>
    <filesMatch "\.(js)$">
    Header set Cache-Control "max-age=216000, private"
    </filesMatch>
    <filesMatch "\.(x?html?|php)$">
    Header set Cache-Control "max-age=600, private, must-revalidate"
    </filesMatch>
    </ifModule>
    # END Cache-Control Headers

    # BEGIN Turn ETags Off
    <ifModule mod_headers.c>
    Header unset ETag
    </ifModule>
    FileETag None
    # END Turn ETags Off

    # BEGIN Remove Last-Modified Header
    <ifModule mod_headers.c>
    Header unset Last-Modified
    </ifModule>
    # END Remove Last-Modified Header

    3)
    ## EXPIRES HEADER CACHING ## <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 application/pdf "access 1 month" ExpiresByType application/javascript "access 1 month" ExpiresByType application/x-javascript "access 1 month" ExpiresByType application/x-shockwave-flash "access 1 month" ExpiresByType image/x-icon "access 1 year" ExpiresDefault "access 2 days" </IfModule> ## EXPIRES HEADER CACHING ##

    All three creates error500. Does it care which language is being used on the site: php/cgi/perl/html/
     
    cm2010, Jun 22, 2017 IP
  2. Akjha

    Akjha Member

    Messages:
    59
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #2
    Lots of factors needed to increase site speed, like minimize HTTP requests, reduce server response time minify resources in terms of javascript and css, enable browser caching in four terms, reduce size of images...... if you expert in website development better to debug or consult experienced people.
     
    Akjha, Jun 23, 2017 IP
  3. WareBehr

    WareBehr Active Member

    Messages:
    18
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    50
    #3
    
    ExpiresDefault "access plus 1 seconds"
    
    Code (markup):
    Try changing that to 60 seconds and let me know if the problem goes away.
     
    WareBehr, Jun 23, 2017 IP