Secured by .htaccess website section 2

As previous posts have mentioned security Secured website using .htaccess now I wrote this section to guide you to use .htaccess for extra security for your website

How secure file Chmod

usually when you upload files to the hosting of the file and will default foder is chmod

For file is 644
for foder is 755

and most of the source code will require chmod config.php file into 777, this is very dangerous when a configuration file is chmod 777 because it has full power, poison + record + erase so you should not chmod any file into 777 but rather the standard chmod in the following way to ensure safety

For File : 644 or 600

to file config.php or wp-config.php Please chmod : 400 to ensure safety for your website

Never chmod these files into 777

If any one of files to retrieve the data recorded and read, please chmod 666 instead of chmod 777

security for an .htaccess file by any

<files wp-config.php>
order allow,deny
deny from all

Protect .htaccess file

<files .htaccess>
order allow,deny
deny from all

Anti run your file any other website ( this one can resist stealing image file as well as other file banw avoid consuming your resources )

#chong trom file
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?*$ [NC]
#RewriteRule \.(gif|jpg)$ – [F]
#RewriteRule \.(gif|jpg)$ [R,L]

You can add any file name does in part (gif|jpg)

Run against another domain on your website

RewriteEngine on
RewriteCond %{HTTP_REFERER} [NC]
RewriteRule .* – [F]

Anti Duplicate Content

# set the canonical url
RewriteEngine On
RewriteCond %{HTTP_HOST} ^ Tenmiencuaban .com $ [NC]
RewriteRule ^(.*)$$1 [R=301,L]

Chống Spam comment

RewriteEngine On
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.* * [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]


VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)

Secured by .htaccess website section 2, 5.0 out of 5 based on 1 rating