faiverson/prode/master/admin/src/.htaccess - Htaccess File

faiverson/prode/master/admin/src/.htaccess

RewriteEngine On
  # If an existing asset or directory is requested go to it as it is
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
    RewriteRule ^ - [L]

    # If the requested pattern is file and file doesn't exist, send 404
    RewriteCond %{REQUEST_URI} ^(/[a-z_-s0-9.]+)+.[a-zA-Z]{2,4}$
    RewriteRule ^ - [L,R=404]

    # otherwise use history router
    RewriteRule ^ /index.html

# ----------------------------------------------------------------------
# | Forcing `https://`                                                 |
# ----------------------------------------------------------------------

# Redirect from the `http://` to the `https://` version of the URL.
# https://wiki.apache.org/httpd/RewriteHTTPToHTTPS

# <IfModule mod_rewrite.c>
#    RewriteEngine On
#    RewriteCond %{HTTPS} !=on
#    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
# </IfModule>

# ----------------------------------------------------------------------
# | Suppressing / Forcing the `www.` at the beginning of URLs          |
# ----------------------------------------------------------------------

# The same content should never be available under two different
# URLs, especially not with and without `www.` at the beginning.
# This can cause SEO problems (duplicate content), and therefore,
# you should choose one of the alternatives and redirect the other
# one.
#
# By default `Option 1` (no `www.`) is activated.
# http://no-www.org/faq.php?q=class_b
#
# If you would prefer to use `Option 2`, just comment out all the
# lines from `Option 1` and uncomment the ones from `Option 2`.
#
# (!) NEVER USE BOTH RULES AT THE SAME TIME!

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Option 1: rewrite www.example.com → example.com

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
    RewriteRule ^ %{ENV:PROTO}://%1%{REQUEST_URI} [R=301,L]
</IfModule>

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Option 2: rewrite example.com → www.example.com
#
# Be aware that the following might not be a good idea if you use "real"
# subdomains for certain parts of your website.

# <IfModule mod_rewrite.c>
#     RewriteEngine On
#     RewriteCond %{HTTPS} !=on
#     RewriteCond %{HTTP_HOST} !^www. [NC]
#     RewriteCond %{SERVER_ADDR} !=127.0.0.1
#     RewriteCond %{SERVER_ADDR} !=::1
#     RewriteRule ^ %{ENV:PROTO}://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# </IfModule>

# ----------------------------------------------------------------------
# | Server-side technology information                                 |
# ----------------------------------------------------------------------

# Remove the `X-Powered-By` response header that:
#
#  * is set by some frameworks and server-side languages
#    (e.g.: ASP.NET, PHP), and its value contains information
#    about them (e.g.: their name, version number)
#
#  * doesn't provide any value as far as users are concern,
#    and in some cases, the information provided by it can
#    be used by attackers
#
# (!) If you can, you should disable the `X-Powered-By` header from the
# language / framework level (e.g.: for PHP, you can do that by setting
# `expose_php = off` in `php.ini`)
#
# https://php.net/manual/en/ini.core.php#ini.expose-php

<IfModule mod_headers.c>
    Header unset X-Powered-By
</IfModule>

# ----------------------------------------------------------------------
# | Server software information                                        |
# ----------------------------------------------------------------------

# Prevent Apache from adding a trailing footer line containing
# information about the server to the server-generated documents
# (e.g.: error messages, directory listings, etc.)
#
# https://httpd.apache.org/docs/current/mod/core.html#serversignature

ServerSignature Off

# ----------------------------------------------------------------------
# | Expires headers                                                    |
# ----------------------------------------------------------------------

# Serve resources with far-future expires headers.
#
# (!) If you don't control versioning with filename-based
# cache busting, you should consider lowering the cache times
# to something like one week.
#
# https://httpd.apache.org/docs/current/mod/mod_expires.html

  <IfModule mod_expires.c>

      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>

On Github License

Files

Download PDF of Htaccess file
DOCUMENT_ROOT, ENV, HTTP_HOST, HTTPS, PROTO, REQUEST_URI, SERVER_ADDR, TIME

Comments

Apache