• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

Anti DDOS and Secure Hosting with .htaccess

AnonyViet by AnonyViet
January 27, 2023
in Network
0

Hypertext Access aka htaccess is a file used to configure the apache web server. It is accepted by the server as a component and allows us to dynamically navigate and enable features or protect a certain part (folder) of the site.

Join the channel Telegram of the AnonyViet 👉 Link 👈

In the name .htaccess, htaccess is the extension and this file has no name, so when you put this file on the host it is not always displayed. For example, if you use Total Commander to handle FTP files, you will not be able to see the .htaccess file.

To manipulating .htaccess files You can use any text editor like Netbeans, PHP Designer, or even the notepadd software available in windows.

Today I will guide you to Anti DDOS and Secure Hosting with .htaccess

Step 1 : Create 1 file .htaccess on your computer or through Cpanel hosting

Step 2 : Open the .htaccess file with any editor

Step 3 : Add the following content to the .htaccess file

order deny,allow
allow from 210.245.90.203
deny from all

According to the above text line, IP 210.245.90.203 will be allowed in your admincp directory, in addition, other IPs will not be accessible except the Allowed IP. To check your computer’s IP, you can refer to this lesson

How to safely chmod files:

Normally when you upload files to hosting the files and folder will default to chmod as

For File to be: 644
for Foder is: 755

and most source code will require chmod file config.php to 777this is very dangerous when a configuration file is chmod 777 because it has full authority, read + write + delete so you shouldn’t chmod any files to 777 but please chmod standard in the following way to be safe

For File : 644 or 600

For files config.php or wp-config.php let’s chmod : 400 To ensure the security of your website

Never chmod these files to 777

If any file needs to access read and write data, then chmod 666 instead of chmod 777

Secure any file with .htaccess

<FILES WP-CONFIG.PHP>
ORDER ALLOW,DENY
DENY FROM ALL
</FILES>

Protect .htaccess files

<FILES .HTACCESS>
ORDER ALLOW,DENY
DENY FROM ALL
</FILES>

Create a simple soft Firewall with .htaccess to fight DDOS

Create a .htaccess file in the directory subject to DDoS access/request continuously (usually the public_html, forum, diendan, 4rum, etc. folders). The file contents are as follows:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?domaincuaban.com [NC]
RewriteRule !antiddos.phtml http://domaincuaban.com/antiddos.phtml?%{REQUEST_URI} [QSA]

Then create file antiddos.phtml placed in the same directory as the .htaccess file, with the content:

<?
$text=$HTTP_SERVER_VARS['QUERY_STRING'];
$text = preg_replace("#php&#si",'php?',$text);
echo('<center><a href=http://domaincuaban.com'.$text.'>[Nhấn vào đây]</a><br>để vào trang chủ.</center>');
?>

Redirect Website when being DDOS, when DDOS attacks will target your Domain, to protect the database to avoid wasting bandwidth for hosting, you can redirect the Domain to another destination eg: facebook.com

Then the attacks instead of hitting your domain will be forwarded DDOS packets via Facebook.

RewriteEngine On
RewriteRule ^(.*)$ http://facebook.com/\ [R=301,L]

Prevent running any of your files through other websites (this can prevent stealing image files as well as other files to avoid wasting your resources)

#CHONG TROM FILE
REWRITEENGINE ON
REWRITECOND % !^$
REWRITECOND % !^HTTP://(WWW.)?TENMIENCUABAN.COM/.*$ [NC]
#REWRITERULE .(GIF|JPG)$ – [F]
#REWRITERULE .(GIF|JPG)$ HTTP://WWW.anonyviet.com/FILE.JPG [R,L]

You can add any file name in the . section (gif|jpg)

Prevent running other domains on your website

REWRITEENGINE ON
REWRITECOND % DUYQUANG.NET [NC]
REWRITERULE .* – [F]

Deduplication of content

# SET THE CANONICAL URL
REWRITEENGINE ON
REWRITECOND % ^TENMIENCUABAN.COM$ [NC]
REWRITERULE ^(.*)$ HTTP://WWW.TENMIENCUABAN.COM/\ [R=301,L]

Anti-Spam comment

REWRITEENGINE ON
REWRITECOND % POST
REWRITECOND % .WP-COMMENTS-POST.PHP*
REWRITECOND % !.*TENMIENCUABAN.COM.* [OR]
REWRITECOND % ^$
REWRITERULE (.*) ^HTTP://%/$ [R=301,L]

The article achieved: 5/5 – (100 votes)

Tags: .htaccessAntiDDoSHostingSecure
Previous Post

How to use Tab Group on Chrome, Firefox, Edge browsers

Next Post

Hack to increase the rate of Headshot Free Fire without software

AnonyViet

AnonyViet

Related Posts

Guide to self -creation socket5 on Ubuntu
Network

Guide to self -creation socket5 on Ubuntu

May 28, 2025
How to create a separate mtproto proxy to use Telegram when blocked
Network

How to create a separate mtproto proxy to use Telegram when blocked

May 25, 2025
Script backup database and website on telegram
Network

Script backup database and website on telegram

May 2, 2025
Create 64GB RAM 16 core for free on Google IDX
Network

Create 64GB RAM 16 core for free on Google IDX

April 13, 2025
What is VPS running Vietnamese software? What is the reason for installing Vietnamese software on VPS?
Network

What is VPS running Vietnamese software? What is the reason for installing Vietnamese software on VPS?

February 17, 2025
Create Ronin wallet to play pixels on VPS Windows
Network

Create Ronin wallet to play pixels on VPS Windows

February 17, 2025
Next Post
Hack to increase the rate of Headshot Free Fire without software

Hack to increase the rate of Headshot Free Fire without software

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

Instructions on how to format text on the Windows 11 notepad

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
Online driving exam preparation: Support theory and practice

Online driving exam preparation: Support theory and practice

August 15, 2025
How to add application to your favorite bar

How to add application to your favorite bar

August 14, 2025
Instructions on how to format text on the Windows 11 notepad

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
Online driving exam preparation: Support theory and practice

Online driving exam preparation: Support theory and practice

August 15, 2025
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

Instructions on how to format text on the Windows 11 notepad

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply