Created
March 12, 2023 05:19
-
-
Save alexsoyes/59522b4421ca81a216da832014e36c16 to your computer and use it in GitHub Desktop.
Alex so yes .htaccess file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BEGIN WP Rocket v3.12.3.2 | |
# Use UTF-8 encoding for anything served text/plain or text/html | |
AddDefaultCharset UTF-8 | |
# Force UTF-8 for a number of file formats | |
<IfModule mod_mime.c> | |
AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml | |
</IfModule> | |
# FileETag None is not enough for every server. | |
<IfModule mod_headers.c> | |
Header unset ETag | |
</IfModule> | |
# Since we’re sending far-future expires, we don’t need ETags for static content. | |
# developer.yahoo.com/performance/rules.html#etags | |
FileETag None | |
# Send CORS headers if browsers request them; enabled by default for images. | |
<IfModule mod_setenvif.c> | |
<IfModule mod_headers.c> | |
# mod_headers, y u no match by Content-Type?! | |
<FilesMatch "\.(avifs?|cur|gif|png|jpe?g|svgz?|ico|webp)$"> | |
SetEnvIf Origin ":" IS_CORS | |
Header set Access-Control-Allow-Origin "*" env=IS_CORS | |
</FilesMatch> | |
</IfModule> | |
</IfModule> | |
# Allow access to web fonts from all domains. | |
<FilesMatch "\.(eot|otf|tt[cf]|woff2?)$"> | |
<IfModule mod_headers.c> | |
Header set Access-Control-Allow-Origin "*" | |
</IfModule> | |
</FilesMatch> | |
<IfModule mod_alias.c> | |
<FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$"> | |
<IfModule mod_headers.c> | |
Header set X-Powered-By "WP Rocket/3.12.3.2" | |
Header unset Pragma | |
Header append Cache-Control "public" | |
Header unset Last-Modified | |
</IfModule> | |
</FilesMatch> | |
<FilesMatch "\.(css|htc|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$"> | |
<IfModule mod_headers.c> | |
Header unset Pragma | |
Header append Cache-Control "public" | |
</IfModule> | |
</FilesMatch> | |
</IfModule> | |
<IfModule mod_mime.c> | |
AddType image/avif avif | |
AddType image/avif-sequence avifs | |
</IfModule> | |
# Expires headers (for better cache control) | |
<IfModule mod_expires.c> | |
ExpiresActive on | |
ExpiresDefault "access plus 1 month" | |
# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5) | |
ExpiresByType text/cache-manifest "access plus 0 seconds" | |
# Your document html | |
ExpiresByType text/html "access plus 0 seconds" | |
# Data | |
ExpiresByType text/xml "access plus 0 seconds" | |
ExpiresByType application/xml "access plus 0 seconds" | |
ExpiresByType application/json "access plus 0 seconds" | |
# Feed | |
ExpiresByType application/rss+xml "access plus 1 hour" | |
ExpiresByType application/atom+xml "access plus 1 hour" | |
# Favicon (cannot be renamed) | |
ExpiresByType image/x-icon "access plus 1 week" | |
# Media: images, video, audio | |
ExpiresByType image/gif "access plus 4 months" | |
ExpiresByType image/png "access plus 4 months" | |
ExpiresByType image/jpeg "access plus 4 months" | |
ExpiresByType image/webp "access plus 4 months" | |
ExpiresByType video/ogg "access plus 4 months" | |
ExpiresByType audio/ogg "access plus 4 months" | |
ExpiresByType video/mp4 "access plus 4 months" | |
ExpiresByType video/webm "access plus 4 months" | |
ExpiresByType image/avif "access plus 4 months" | |
ExpiresByType image/avif-sequence "access plus 4 months" | |
# HTC files (css3pie) | |
ExpiresByType text/x-component "access plus 1 month" | |
# Webfonts | |
ExpiresByType font/ttf "access plus 4 months" | |
ExpiresByType font/otf "access plus 4 months" | |
ExpiresByType font/woff "access plus 4 months" | |
ExpiresByType font/woff2 "access plus 4 months" | |
ExpiresByType image/svg+xml "access plus 4 months" | |
ExpiresByType application/vnd.ms-fontobject "access plus 1 month" | |
# CSS and JavaScript | |
ExpiresByType text/css "access plus 1 year" | |
ExpiresByType application/javascript "access plus 1 year" | |
</IfModule> | |
# Gzip compression | |
<IfModule mod_deflate.c> | |
# Active compression | |
SetOutputFilter DEFLATE | |
# Force deflate 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 | |
# Don’t compress images and other uncompressible content | |
SetEnvIfNoCase Request_URI \ | |
\.(?:gif|jpe?g|png|rar|zip|exe|flv|mov|wma|mp3|avi|swf|mp?g|mp4|webm|webp|pdf)$ no-gzip dont-vary | |
</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/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 mod_headers.c> | |
Header append Vary: Accept-Encoding | |
</IfModule> | |
</IfModule> | |
# END WP Rocket | |
# BEGIN Imagify: rewrite rules for webp | |
<IfModule mod_setenvif.c> | |
# Vary: Accept for all the requests to jpeg, png, and gif. | |
SetEnvIf Request_URI "\.(jpg|jpeg|jpe|png|gif)$" REQUEST_image | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
# Check if browser supports WebP images. | |
RewriteCond %{HTTP_ACCEPT} image/webp | |
# Check if WebP replacement image exists. | |
RewriteCond %{REQUEST_FILENAME}.webp -f | |
# Serve WebP image instead. | |
RewriteRule (.+)\.(jpg|jpeg|jpe|png|gif)$ $1.$2.webp [T=image/webp,NC] | |
</IfModule> | |
<IfModule mod_headers.c> | |
Header append Vary Accept env=REQUEST_image | |
</IfModule> | |
# END Imagify: rewrite rules for webp | |
# BEGIN ALEX 2021/11/18 | |
<IfModule mod_mime.c> | |
AddDefaultCharset utf-8 | |
AddCharset utf-8 .woff .woff2 | |
AddType application/font-woff2 .woff2 | |
</IfModule> | |
# Block WordPress xmlrpc.php requests | |
<Files xmlrpc.php> | |
order deny,allow | |
deny from all | |
</Files> | |
# END ALEX | |
# BEGIN SECURITY BY ALEX | |
<IfModule mod_headers.c> | |
# Additional protection | |
Header set X-XSS-Protection "1; mode=block" | |
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" | |
Header set X-Frame-Options "SAMEORIGIN" | |
Header set X-Content-Type-Options "nosniff" | |
Header set Referrer-Policy "strict-origin-when-cross-origin" | |
Header set Content-Security-Policy "default-src 'self' https: 'unsafe-eval' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' *.hotjar.com *.list-manage.com chimpstatic.com www.clarity.ms downloads.mailchimp.com www.gstatic.com googleads.g.doubleclick.net ajax.googleapis.com www.google-analytics.com www.googletagmanager.com *.wp.com gist.github.com; img-src 'self' data: *.gravatar.com c.clarity.ms c.bing.com *.ytimg.com s.w.org ps.w.org *.wp.com www.google-analytics.com downloads.mailchimp.com mcusercontent.com; style-src 'self' 'unsafe-inline' downloads.mailchimp.com fonts.googleapis.com gist.github.com github.githubassets.com; font-src 'self' 'unsafe-inline' fonts.gstatic.com data:; form-action 'self' alexsoyes.us8.list-manage.com; base-uri 'self'" | |
Header set Permissions-Policy "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=()" | |
# Header set Feature-Policy "accelerometer 'none'; camera 'none'; geolocation 'none'; gyroscope 'none'; magnetometer 'none'; microphone 'none'; payment 'none'; usb 'none'" | |
# Remove info | |
Header unset "Server" | |
Header unset "X-Powered-By" | |
</IfModule> | |
# END SECURITY BY ALEX | |
# https://fr.docs.wp-rocket.me/article/214-activer-la-compression-gzip | |
# Gzip compression | |
<IfModule mod_deflate.c> | |
# Performance | |
<filesMatch ".(ico|jpg|jpeg|png|gif)$"> | |
Header set Cache-Control "max-age=2592000, public" | |
</filesMatch> | |
<filesMatch ".(css|js)$"> | |
Header set Cache-Control "max-age=86400, public" | |
</filesMatch> | |
# Active compression | |
SetOutputFilter DEFLATE | |
# Force deflate 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 | |
# Don’t compress images and other uncompressible content | |
SetEnvIfNoCase Request_URI \ | |
\.(?:gif|jpe?g|png|rar|zip|exe|flv|mov|wma|mp3|avi|swf|mp?g|mp4|webm|webp|pdf)$ no-gzip dont-vary | |
</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/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 mod_headers.c> | |
Header append Vary: Accept-Encoding | |
</IfModule> | |
</IfModule> | |
<IfModule mod_mime.c> | |
AddType text/html .html_gzip | |
AddEncoding gzip .html_gzip | |
</IfModule> | |
<IfModule mod_setenvif.c> | |
SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip | |
</IfModule> | |
# https://fr.docs.wp-rocket.me/article/215-mise-en-cache-du-navigateur | |
# Expires headers (for better cache control) | |
<IfModule mod_expires.c> | |
ExpiresActive on | |
# Perhaps better to whitelist expires rules? Perhaps. | |
ExpiresDefault "access plus 1 month" | |
# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5) | |
ExpiresByType text/cache-manifest "access plus 0 seconds" | |
# Your document html | |
ExpiresByType text/html "access plus 0 seconds" | |
# Data | |
ExpiresByType text/xml "access plus 0 seconds" | |
ExpiresByType application/xml "access plus 0 seconds" | |
ExpiresByType application/json "access plus 0 seconds" | |
# Feed | |
ExpiresByType application/rss+xml "access plus 1 hour" | |
ExpiresByType application/atom+xml "access plus 1 hour" | |
# Favicon (cannot be renamed) | |
ExpiresByType image/x-icon "access plus 1 week" | |
# Media: images, video, audio | |
ExpiresByType image/gif "access plus 4 months" | |
ExpiresByType image/png "access plus 4 months" | |
ExpiresByType image/jpeg "access plus 4 months" | |
ExpiresByType image/webp "access plus 4 months" | |
ExpiresByType video/ogg "access plus 1 month" | |
ExpiresByType audio/ogg "access plus 1 month" | |
ExpiresByType video/mp4 "access plus 1 month" | |
ExpiresByType video/webm "access plus 1 month" | |
# HTC files (css3pie) | |
ExpiresByType text/x-component "access plus 1 month" | |
# Webfonts | |
ExpiresByType font/ttf "access plus 4 months" | |
ExpiresByType font/otf "access plus 4 months" | |
ExpiresByType font/woff "access plus 4 months" | |
ExpiresByType font/woff2 "access plus 4 months" | |
ExpiresByType image/svg+xml "access plus 1 month" | |
ExpiresByType application/vnd.ms-fontobject "access plus 1 month" | |
# CSS and JavaScript | |
ExpiresByType text/css "access plus 1 year" | |
ExpiresByType application/javascript "access plus 1 year" | |
</IfModule> | |
# BEGIN Imagify: webp file type | |
<IfModule mod_mime.c> | |
AddType image/webp .webp | |
</IfModule> | |
# END Imagify: webp file type | |
<IfModule mod_rewrite.c> | |
# Forces "https" | |
RewriteEngine On | |
RewriteCond %{HTTPS} !on | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
# Remove "www" | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC] | |
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301] | |
</IfModule> | |
# BEGIN rlrssslReallySimpleSSL rsssl_version[3.3.2] | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] | |
</IfModule> | |
# END rlrssslReallySimpleSSL | |
# BEGIN WordPress | |
# Les directives (lignes) entre « BEGIN WordPress » et « END WordPress » sont générées | |
# dynamiquement, et doivent être modifiées uniquement via les filtres WordPress. | |
# Toute modification des directives situées entre ces marqueurs sera surchargée. | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> | |
# BEGIN SEOKEY | |
<files sitemap*.xml> | |
Header set X-Robots-Tag "noindex,follow" | |
</files> | |
# END SEOKEY | |
# END WordPress |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment