Skip to content

Instantly share code, notes, and snippets.

@drbyte
Created September 2, 2017 15:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drbyte/89cb9594e0f83b1c932e7470a38ced3e to your computer and use it in GitHub Desktop.
Save drbyte/89cb9594e0f83b1c932e7470a38ced3e to your computer and use it in GitHub Desktop.
.well-known rewrites for apache
# ----------------------------------------------------------------------
# Put well known resources in the .well-known folder
# https://github.com/fvsch/scripts-and-snippets/blob/master/apache/rewrite-well-known.conf
# ----------------------------------------------------------------------
RewriteCond %{REQUEST_FILENAME} !-f
# Some very common, then less common "well-known" patterns
RewriteCond %{REQUEST_URI} =/favicon.jpg [OR]
RewriteCond %{REQUEST_URI} =/favicon.ico [OR]
RewriteCond %{REQUEST_URI} =/robots.txt [OR]
RewriteCond %{REQUEST_URI} =/crossdomain.xml [OR]
RewriteCond %{REQUEST_URI} =/apple-touch-icon.png [OR]
RewriteCond %{REQUEST_URI} =/apple-touch-icon-precomposed.png [OR]
RewriteCond %{REQUEST_URI} =/foaf.rdf [OR]
RewriteCond %{REQUEST_URI} =/w3c/p3p.xml [OR]
RewriteCond %{REQUEST_URI} ^/google[\da-f]{16}\.html$ [OR]
RewriteCond %{REQUEST_URI} ^/y_key_[\da-f]{16}\.html$ [OR]
RewriteCond %{REQUEST_URI} =/BingSiteAuth.xml$ [OR]
RewriteCond %{REQUEST_URI} =/myopenid-hosted-verification.html [OR]
RewriteCond %{REQUEST_URI} =/humans.txt
# To further limit possible issues (e.g. if you mess up the conditions above),
# we only match files at the root, not folders or files in subfolders
RewriteRule ^([a-z0-9\-\._]+)$ /.well-known/$1 [L,NC]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment