.htaccess file help and or issues


(tankgryl) #1

Its a case of a little bit of information is a dangerous thing. I run speed test on the site and i always get issues with compression gzip. So well i play around, and then i forget or go back in a couple of months and do it again.
I have watch Joe Workman’s great podcasts on .htaccess but at this point i think i am in over my head as i have added to much and i am worried about deleting - i know i have double code in there.
Could someone have a quick look for me?

This is the full .htaccess file:

Header append Vary User-Agent env=!dont-vary AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json # DEFLATE by extension AddOutputFilter DEFLATE js css htm html xml

Disable Directory Access

Options -Indexes

Expire times for caching

ExpiresActive on
ExpiresDefault                                      "access plus 1 month"

CSS

ExpiresByType text/css                              "access plus 1 year"

Data interchange

ExpiresByType application/json                      "access plus 0 seconds"
ExpiresByType application/xml                       "access plus 0 seconds"
ExpiresByType text/xml                              "access plus 0 seconds"

Favicon (cannot be renamed!) and cursor images

ExpiresByType image/x-icon                          "access plus 1 week"

HTML components (HTCs)

ExpiresByType text/x-component                      "access plus 1 month"

HTML

ExpiresByType text/html                             "access plus 0 seconds"

JavaScript

ExpiresByType application/javascript                "access plus 1 year"

Manifest files

ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
ExpiresByType text/cache-manifest                   "access plus 0 seconds"

Media

ExpiresByType audio/ogg                             "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 video/mp4                             "access plus 1 month"
ExpiresByType video/ogg                             "access plus 1 month"
ExpiresByType video/webm                            "access plus 1 month"

Web feeds

ExpiresByType application/atom+xml                  "access plus 1 hour"
ExpiresByType application/rss+xml                   "access plus 1 hour"

Web fonts

ExpiresByType application/font-woff                 "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject         "access plus 1 month"
ExpiresByType application/x-font-ttf                "access plus 1 month"
ExpiresByType font/opentype                         "access plus 1 month"
ExpiresByType image/svg+xml                         "access plus 1 month"
<IfModule mod_filter.c>
    AddOutputFilterByType DEFLATE application/atom+xml \
                                  application/javascript \
                                  application/json \
                                  application/rss+xml \
                                  application/vnd.ms-fontobject \
                                  application/x-font-ttf \
                                  application/x-web-app-manifest+json \
                                  application/xhtml+xml \
                                  application/xml \
                                  font/opentype \
                                  image/svg+xml \
                                  image/x-icon \
                                  text/css \
                                  text/html \
                                  text/plain \
                                  text/x-component \
                                  text/xml
</IfModule>

BEGIN GZIP

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript ## END GZIP ## Header append Vary: Accept-Encoding

Compression with gzip

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.*

secure htaccess file

<Files .htaccess>
order allow,deny
deny from all


(Rob D) #2

Sorry, man, I don’t have an answer for you. But, perhaps you could post the link to that podcast on .htaccess? That is something I am interested in.


(Robert Ziebol 🖖🏼) #3

Here you go, to weaver casts


and


(Rob D) #4

@zeebe – Thanks a lot.


(Mark Sealey) #5

The .htaccess file is a set of parameters which the web server Apache uses to control the way it serves pages.

(It’s always a good idea to make a backup - perhaps calling it SAFEdothtaccess - before you begin; Apache only looks for that one file, ‘hatches’ so it’s safe to make such a copy.)

One thing you could do is search online for a ‘clean’ .htaccess file - one which has not been customised as you have customised yours - and drop it in instead of the one you’ve changed; and start from there.

Good luck!


(tankgryl) #6

good point Mark, thanks


(tankgryl) #7

i have looked at them… and thats where i got most of my fillers for the .htlaccess file i have