The Apache htaccess file

Card Puncher Data Processing

About

The .htaccess file is a an apache configuration file that you can find in a directory of your website.

The configuration defined in this file is only available for this directory and the sub-directories (not global except for the .htaccess file stored at the root of your website)

Example: Setting an header conditionally

If the mod_header is present, Apache can add/delete headers

Example in the root .htaccess file, with the cache control

# Cache File
<IfModule mod_headers.c>
    # WEEK
    <FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
        Header set Cache-Control "max-age=604800, public"
    </FilesMatch>

    # WEEK
    <FilesMatch "\.(js|css|swf)$">
        Header set Cache-Control "max-age=604800"
    </FilesMatch>
</IfModule>





Discover More
Card Puncher Data Processing
Apache - HTTP Header (mod_header module)

mod_header is a apache module that permits to set HTTP header. If you add the below code snippet in your htaccess file, you will set the following response header the cache-control header and...
Card Puncher Data Processing
Apache - URL Rewrite (mod_rewrite)

URL rewrite in Apache is done through the rewrite module. The rules are set in the htaccess file This module operates on the full URLs (including the path-info part) both: in per-server context (httpd.conf)...
Cors Flowchart
Browser - Cross Origin Resource Sharing (CORS)

Cross-origin resource sharing (CORS) is a mechanism that: * allows a HTTP server * to control the cross-origin requests executed by a browser. In short, a HTTP server may allow or not to receive...
Hsts Chrome Message
HTTP - Strict Transport Security (HSTS) - mandatory HTTPS

Strict Transport Security (HSTS) is a header that tells the client that the website should always be contacted with HTTPS When HSTS is on, if it's not possible to make a https connection (for instance...
Devtool Tracking Cookie Identifier Counter
How does a tracking cookie work? A step by step example

This page shows you a basic example of a tracking ... cookie so that you can understand and implement the underlying mechanisms. These cookies are third-party cookie. A tracking cookie is also known...
Card Puncher Data Processing
How to enable CORS on a Apacher Web Server?

This article shows you how to enable CORS for an Apache Web Server To configure cors on a Apache server, you may do it: in a file or via the module. in the Apache configuration file...
Cors Blocked
How to resolve a blockage due to a CORS policy error? A getting started guide

A detailled step by step guide on why you can get a CORS policy violation and how to simply resolve it
React - Deployment - Routing for client side router

With client side router, a direct HTTP call will failed if you are not using some routing features (such as ) For a create-react-app React application, all URL must be redirected to the index.html...
The Cache-Control HTTP header

The cache control header is the most important header in the HTTP cache mechanism and permits to turn it on or off alongside other properties.



Share this page:
Follow us:
Task Runner