How to prevent Cross Site Scripting(XSS) injection attack in your Website?

Cross-site Scripting (XSS) is a client-side code injection attack. The attacker aims to execute malicious scripts in a web browser of the victim by including malicious code in a legitimate web page or web application. The actual attack occurs when the victim visits the web page or web application that executes the malicious code.

Step::1 Login to cPanel and open File Manager section

Step::2 Go to public_html

Step::3 Now find .htaccess file and right click over and choose the Edit option

Step::4 Copy the code given below:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]

Step::5 Paste this code in your .htaccess file and click on Save changes

Visit our Blog for more details. You can also watch the video here.

  • How to prevent cross site scripting injection attack in your Web, Cross Site Scripting, cpanel, XSS Attack
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

How to protect PHP file execution in a specific directory?

Having some directories writeable by default makes your site vulnerable to hacker attacks....

How to Create backup & store them remotely in any Server using SCP?

Step::1 Login to cPanel and go to Backup Wizard in Files section.Step::2 Now click over Backup...

How to find all http in your website and replace them with https in cPanel?

Step::1 Login to your cPanel and open File ManagerStep::2 Next go inside public_html and create a...

How to secure ‘public html’?

Permissions can be very important when it comes to hosting your website. Permissions can allow...

How to Setup file permissions of any file in cPanel?

Permissions can be very important when it comes to hosting your website. Permissions can allow...