Skip to content

Instantly share code, notes, and snippets.

@mohsinrasool
Forked from eveland/.htaccess
Created December 23, 2015 16:41
Show Gist options
  • Select an option

  • Save mohsinrasool/3ebc8c0a4a6a310ab2eb to your computer and use it in GitHub Desktop.

Select an option

Save mohsinrasool/3ebc8c0a4a6a310ab2eb to your computer and use it in GitHub Desktop.
.htaccess
#Require SSL
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
<Files super-secret.pdf>
Order Allow,Deny
Deny from all
</Files>
<FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">
Order Allow,Deny
Deny from all
</FilesMatch>
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domain.com [NC]
RewriteRule \.(gif|jpe?g?|png)$ - [NC,F,L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment