Skip to content

Instantly share code, notes, and snippets.

@jgmac1106
Last active December 14, 2018 19:55
Show Gist options
  • Save jgmac1106/82a7c81dab73f447adf0e292070f3c0e to your computer and use it in GitHub Desktop.
Save jgmac1106/82a7c81dab73f447adf0e292070f3c0e to your computer and use it in GitHub Desktop.
Known htaccess
Known .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine on
#RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteRule ^.well-known/(host-meta|webfinger).* https://fed.brid.gy/$0 [redirect=302,last]
RewriteCond %{ENV:BASE} ^$
RewriteCond $1::%{REQUEST_URI} ^(.*)::(.*?)\1$
RewriteRule ^(.*)$ - [ENV=BASE:%2]
RewriteRule ^js/canary\.js$ %{ENV:BASE}/js/default.js [L]
# The query string cache trick doesn't really work, so use rewrite rules instead
RewriteRule ^js/[0-9]+/(.*)$ %{ENV:BASE}/js/$1 [L]
RewriteRule ^css/[0-9]+/(.*)$ %{ENV:BASE}/css/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ %{ENV:BASE}/index.php?/$1 [L,QSA]
RewriteRule ^Uploads.* - [F]
</IfModule>
<Files ~ "\.dist$">
Order allow,deny
Deny from all
</Files>
<Files ~ "composer\.lock">
Order allow,deny
Deny from all
</Files>
<Files ~ "known\.php">
Order allow,deny
Deny from all
</Files>
<Files ~ "\.known">
Order allow,deny
Deny from all
</Files>
<Files ~ "\.ini$">
Order allow,deny
Deny from all
</Files>
<Files ~ "\.yml$">
Order allow,deny
Deny from all
</Files>
<Files ~ "\.xml$">
Order allow,deny
Deny from all
</Files>
<Files ~ "sitemap\.xml">
Order allow,deny
Allow from all
</Files>
<Files ~ "feed\.xml">
Order allow,deny
Allow from all
</Files>
<Files ~ "rss\.xml">
Order allow,deny
Allow from all
</Files>
#<Files ~ "\.php$">
# Order allow,deny
# Deny from all
#</Files>
<Files ~ "warmup\/*\.*">
Order allow,deny
Allow from all
</Files>
<Files ~ "index\.php">
Order allow,deny
Allow from all
</Files>
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment