RewriteEngine On
RewriteCond %{REQUEST_URI} !^/domain.com/
RewriteRule ^(.*)$ sub-folder/$1 [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#Protect .htaccess
<Files ~ “^.*\.([Hh][Tt][Aa])”>
order allow,deny
deny from all
satisfy all
</Files>
# disable the server signature
ServerSignature Off
# limit file uploads to 10mb
LimitRequestBody 10240000
# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>
#who has access who doesnt
order allow,deny
#deny from 000.000.000.000
allow from all
#custom error docs
#ErrorDocument 404 /notfound.php
#ErrorDocument 403 /forbidden.php
#ErrorDocument 500 /error.php
# disable directory browsing
Options All -Indexes
#block referring domains
#RewriteEngine on
#RewriteCond %{HTTP_REFERER} digg\.com [NC]
#RewriteRule .* – [F]
#disable hotlinking of images with forbidden or custom image option
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/.*$ [NC]
#RewriteRule \.(gif|jpg)$ – [F]
RewriteRule \.(jpe?g|gif|bmp|png)$ http://www.domain.com/stealingisbad.gif [R,L]
# set the canonical url
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
# protect from spam comments
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*domain.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
# END WordPress
# MAINTENANCE-PAGE REDIRECT
#Replace 123.456.789.000 with your ip adress
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteRule .* /maintenance.html [R=302,L]
Sources