Skip to content

Instantly share code, notes, and snippets.

@enrikberisha
Last active May 18, 2018 12:12
Show Gist options
  • Save enrikberisha/4a94fb2861100ada2be66c52312d7480 to your computer and use it in GitHub Desktop.
Save enrikberisha/4a94fb2861100ada2be66c52312d7480 to your computer and use it in GitHub Desktop.
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
AuthType Basic
AuthName "BETA Site"
AuthUserFile "/var/www/vhosts/rederp.ch/html/_beta.rederp.ch/.htpasswd"
Require valid-user
</IfModule>
wk:$apr1$R.JuDQ11$V6oReBCgR7Jc52.JJG6n9/
#Redirect All
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
#Redirect all without Subdomains
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R=301]
#BEGIN Force SSL
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
#END Force SSL
# 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
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cutisonic.info$ [OR]
RewriteCond %{HTTP_HOST} ^www\.cutisonic.info$
RewriteRule ^/?$ "https\:\/\/www\.cutisonic.eu/" [R=301,L]
<IfModule mod_rewrite.c>
RewriteEngine on
# Attempt to load files from production if
# they're not in our local version
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule wp-content/uploads/(.*) \
http://{PROD}/wp-content/uploads/$1 [NC,L]
</IfModule>
# BEGINTWIG special
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} .twig$
RewriteRule . /index.php [L]
</IfModule>
# END Twig special
# BEGIN WKCustom
# Disable Directory Browsing
Options -Indexes
<files wp-config.php>
order allow,deny
deny from all
</files>
# BEGIN block author scans
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} (author=\d+) [NC]
RewriteRule .* - [F]
# END block author scans
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
# END WKCustom
Order deny,allow
Deny from all
<Files ~ ".(xml|css|jpe?g|png|gif|js|ttf|woff|svg|woff2|eot|pdf|docx|rtf|odf|zip|rar)$">
Allow from all
</Files>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment