2010-09-24, 13:32:34
I found this by googling. It's for wordpress but I made some changes to adopt for GS. I'm not sure if this is the "best" so I'd appreciate any help. My installation is default GS template.
******************************************
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>
# disable the server signature
ServerSignature Off
# limit file uploads to 10mb
### LimitRequestBody 10240000
# protect gsconfig.php
<files gsconfig.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
#redirect old to new
###Redirect 301 /old.php http://www.MYWEBSITE.com/new.php
#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\.)?MYWEBSITE.com/.*$ [NC]
#RewriteRule \.(gif|jpg)$ – [F]
#RewriteRule \.(gif|jpg)$ http://www.MYWEBSITE.com/stealingisbad.gif [R,L]
# php compression – use with caution
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>
# set the canonical url
RewriteEngine On
RewriteCond %{HTTP_HOST} ^MYWEBSITE\.com$ [NC]
RewriteRule ^(.*)$ http://www.MYWEBSITE.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} !.*MYWEBSITE.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
*************************************************
Please comment what lines are needed, what's not? Are there missing entries to improve security?
Thanks in advance!
******************************************
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>
# disable the server signature
ServerSignature Off
# limit file uploads to 10mb
### LimitRequestBody 10240000
# protect gsconfig.php
<files gsconfig.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
#redirect old to new
###Redirect 301 /old.php http://www.MYWEBSITE.com/new.php
#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\.)?MYWEBSITE.com/.*$ [NC]
#RewriteRule \.(gif|jpg)$ – [F]
#RewriteRule \.(gif|jpg)$ http://www.MYWEBSITE.com/stealingisbad.gif [R,L]
# php compression – use with caution
<ifmodule mod_php4.c>
php_value zlib.output_compression 16386
</ifmodule>
# set the canonical url
RewriteEngine On
RewriteCond %{HTTP_HOST} ^MYWEBSITE\.com$ [NC]
RewriteRule ^(.*)$ http://www.MYWEBSITE.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} !.*MYWEBSITE.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
*************************************************
Please comment what lines are needed, what's not? Are there missing entries to improve security?
Thanks in advance!