0% found this document useful (0 votes)
6 views

2 Htaccess

This document contains Apache configuration directives to rewrite URLs, restrict access to certain file types, and configure caching expiration times for various file types including images, videos, fonts and CSS/JavaScript files.

Uploaded by

bambang.wahy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

2 Htaccess

This document contains Apache configuration directives to rewrite URLs, restrict access to certain file types, and configure caching expiration times for various file types including images, videos, fonts and CSS/JavaScript files.

Uploaded by

bambang.wahy
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

<IfModule mod_rewrite.

c>
RewriteEngine On

# Send would-be 404 requests to Craft


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>

# Restrict access to DotFiles (like .htaccess, , .gitignore....)


<FilesMatch "^\.">
Order allow,deny
Deny from all
</FilesMatch>

# Restrict access to system files


<FilesMatch "^(composer.json|composer.lock|mitra|app_key)">
Order allow,deny
Deny from all
</FilesMatch>

<FilesMatch "(?i)\.(zip|rar)$">
Deny from all
</FilesMatch>

# Expire Caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access 1 year"

#Font
AddType application/Cabin-Regular-TTF .ttf
AddType application/fontawesome-webfont .woff2

# Images
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 image/webp "access 1 year"
ExpiresByType image/svg+xml "access 1 year"
ExpiresByType image/x-icon "access 1 year"

# Video
ExpiresByType video/mp4 "access 1 year"
ExpiresByType video/mpeg "access 1 year"

# CSS, JavaScript
ExpiresByType text/css "access 1 year"
ExpiresByType application/javascript "access 1 year"
ExpiresByType application/x-javascript "access 1 year"

# Others
ExpiresByType application/pdf "access 1 year"
ExpiresByType application/x-shockwave-flash "access 1 year"
ExpiresByType application/font-woff "access 1 year"
ExpiresByType application/font-woff2 "access 1 year"
</IfModule>

You might also like