RewriteEngine on # prevent httpd from serving dotfiles (.htaccess, .svn, .git, etc.) - except let's encrypt challenge RedirectMatch 403 ^/?\.(?!/well-known/acme-challenge/[\w-]{43}$) # RewriteBase is required in some hosting environments (Amazon EC2, ...) #RewriteBase / # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # prevent application 404 errors RewriteCond %{REQUEST_FILENAME} !robots\.txt RewriteCond %{REQUEST_FILENAME} !favicon\.ico # otherwise forward it to index.php RewriteRule . index.php