• 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/$1 [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/$1 [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

Save image as Type contains malicious code: Remove immediately before losing money unfairly!
Network

Save image as Type contains malicious code: Remove immediately before losing money unfairly!

March 19, 2026
Instructions on how to register a .co.uk domain name for free for 1 year
Network

Instructions on how to register a .co.uk domain name for free for 1 year

March 12, 2026
How to Setup Paperclip AI: Create a Company for AI Agent
Network

How to Setup Paperclip AI: Create a Company for AI Agent

March 12, 2026
Compilation of free and cheap APIs to run OpenClaw stably
Network

Compilation of free and cheap APIs to run OpenClaw stably

March 10, 2026
3 Services to Determine IP Location for Website (IP Geolocation API)
Network

3 Services to Determine IP Location for Website (IP Geolocation API)

March 10, 2026
How to buy a .STORE domain name for 1 USD (2026): Detailed instructions from A–Z
Network

How to buy a .STORE domain name for 1 USD (2026): Detailed instructions from A–Z

March 3, 2026
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

4K Video Downloader Plus – Tool to download YouTube videos on macOS

4K Video Downloader Plus – Tool to download YouTube videos on macOS

April 20, 2026
How to add Watermark to Google Docs to protect copyright

How to add Watermark to Google Docs to protect copyright

April 19, 2026
How to intercept traffic using Burp Suite to analyze HTTP/HTTPS

How to intercept traffic using Burp Suite to analyze HTTP/HTTPS

April 18, 2026
How to avoid Adblock detection on Youtube with 4 good tips

How to avoid Adblock detection on Youtube with 4 good tips

April 17, 2026
4K Video Downloader Plus – Tool to download YouTube videos on macOS

4K Video Downloader Plus – Tool to download YouTube videos on macOS

April 20, 2026
How to add Watermark to Google Docs to protect copyright

How to add Watermark to Google Docs to protect copyright

April 19, 2026
How to intercept traffic using Burp Suite to analyze HTTP/HTTPS

How to intercept traffic using Burp Suite to analyze HTTP/HTTPS

April 18, 2026
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

4K Video Downloader Plus – Tool to download YouTube videos on macOS

4K Video Downloader Plus – Tool to download YouTube videos on macOS

April 20, 2026
How to add Watermark to Google Docs to protect copyright

How to add Watermark to Google Docs to protect copyright

April 19, 2026
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

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