I'm still working my way round htaccess and would like some input on whether my code is correct or needs some work. Also I know there are tonnes of questions like this but still can't figure it out, how do I rewrite the URL `days/content.php?day=mon` to `days/mon` or `days/content/mon`? Thanks!

```html
#---------------------------------------------------------
#rewrite engine + rewritecond
#---------------------------------------------------------
<IfModule mod_rewrite.c>
  # enable the rewrite engine
  Options +FollowSymlinks
  RewriteEngine On

  # Set your root directory
  RewriteBase /

  # To externally redirect /dir/foo.php to /dir/foo
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
  RewriteRule ^ %1 [R,L,NC]

  ## To internally redirect /dir/foo to /dir/foo.php
  RewriteCond %{REQUEST_FILENAME}.php -f [NC]
  RewriteRule ^ %{REQUEST_URI}.php [L]

  # remove index and reference the directory
  RewriteRule (.*)/index$ $1/ [R=301]

  # remove trailing slash if not a directory
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} /$
  RewriteRule (.*)/ $1 [R=301]

  #prevent hotlinking
  RewriteCond %{HTTP_REFERER} !^$
  RewriteCond %{HTTP_REFERER} !^https?://(.+\.)?dundaah.com [NC]
  RewriteRule \.(jpe?g|png|gif|bmp|css|js|php|xml)$ - [NC,F,L]

  #deny access to hidden files and directories
  RewriteCond %{SCRIPT_FILENAME} -d [OR]
  RewriteCond %{SCRIPT_FILENAME} -f
  RewriteRule "(^|/)\." - [F]

</IfModule>

#---------------------------------------------------------
#compress text files
#---------------------------------------------------------
<IfModule mod_deflate.c>

    # Force compression for mangled headers.
    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        </IfModule>
    </IfModule>

    # Compress all output labeled with one of the following MIME-types
    <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>

</IfModule>

#---------------------------------------------------------
#compress files with mod_gzip
#---------------------------------------------------------
<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>

#---------------------------------------------------------
#set expires headers cache control 
#---------------------------------------------------------
<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault                                      "access plus 1 week"
#CSS
    ExpiresByType text/css                              "access plus 1 week"
#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!)
    ExpiresByType image/x-icon                          "access plus 1 week"
#HTML components (HTCs)
    ExpiresByType text/x-component                      "access plus 1 week"
#HTML
    ExpiresByType text/html                             "access plus 0 seconds"
#JavaScript
    ExpiresByType application/javascript                "access plus 1 week"
#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 week"
    ExpiresByType image/gif                             "access plus 1 week"
    ExpiresByType image/jpeg                            "access plus 1 week"
    ExpiresByType image/jpg                             "access plus 1 week"
    ExpiresByType image/png                             "access plus 1 week"
    ExpiresByType video/mp4                             "access plus 1 week"
    ExpiresByType video/ogg                             "access plus 1 week"
    ExpiresByType video/webm                            "access plus 1 week"
#Web feeds
    ExpiresByType application/atom+xml                  "access plus 1 hour"
    ExpiresByType application/rss+xml                   "access plus 1 hour"
#Web fonts
    ExpiresByType application/font-woff2                "access plus 1 month"
    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>

#---------------------------------------------------------
#cache files
#---------------------------------------------------------
<ifModule mod_headers.c>
    <filesMatch ".(ico|jpe?g|png|gif|swf)$">
        Header set Cache-Control "public"
    </filesMatch>

    <filesMatch ".(css)$">
        Header set Cache-Control "public"
    </filesMatch>

    <filesMatch ".(js)$">
        Header set Cache-Control "private"
    </filesMatch>

    <filesMatch ".(x?html?|php)$">
        Header set Cache-Control "private, must-revalidate"
    </filesMatch>

    #to disable for certain file type
    <FilesMatch ".(pl|php|cgi|spl|scgi|fcgi)$">
        Header unset Cache-Control
    </FilesMatch>
</ifModule>

#---------------------------------------------------------
#turn e-tags off
#---------------------------------------------------------
<IfModule mod_headers.c>
    Header unset ETag
</IfModule>
FileETag None

#---------------------------------------------------------
#disable dir browsing + script execution
#---------------------------------------------------------
Options -Indexes -ExecCGI
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi

#---------------------------------------------------------
#block access to your .htaccess file + more
#---------------------------------------------------------
<Files .htaccess>
  order allow,deny
  deny from all
</Files>

#---------------------------------------------------------
#create custom error pages
#---------------------------------------------------------
ErrorDocument 400 /errors/400.php
ErrorDocument 401 /errors/401.php
ErrorDocument 403 /errors/403.php
ErrorDocument 404 /errors/404.php
ErrorDocument 500 /errors/500.php

#---------------------------------------------------------
#display no php errors to user
#---------------------------------------------------------
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off

#---------------------------------------------------------
# log php errors to file
#---------------------------------------------------------
php_flag log_errors on
#php_value error_log /location/to/php_error.log
```