Googlebot continues to crawl these dead or non-existent URLs, burning through your finite crawl budget and leaving your site trapped in endless Search Console indexing validation loops.
In this tutorial, we will walk through a production-proven workflow on an Ubuntu server running CyberPanel and OpenLiteSpeed to force true protocol-level 410 Gone headers, bypass WordPress application routing, and rapidly clean up Google Search Console.
Prerequisites
Root or administrative access to your Ubuntu server via SSH.
Access to your CyberPanel dashboard.
Access to Google Search Console.
Step 1: Diagnose the Problem via Terminal
Before applying rules, verify what response code your server is currently returning for the infected URLs. Run the following curl command in your terminal:
curl -I https://yourdomain.com/infected-url-path/Step 2: Configure OpenLiteSpeed Rules in CyberPanel (To Avoid WordPress Interception)
Many administrators make the mistake of placing rewrite rules at the bottom of the .htaccess file inside public_html. Because WordPress handles routing via its own rules (below # BEGIN WordPress), it intercepts requests and serves its own templates first.
To ensure OpenLiteSpeed catches malicious patterns before WordPress touches them, configure them at the server level via CyberPanel:
Log in to your CyberPanel dashboard.
Navigate to Websites List Websites Click Manage next to your domain.
Scroll down to the Rewrite Rules section.
Add your rules at the very top of the box.
Example 1: Blocking Path Patterns (e.g., Spam Keywords like “Casino”)
If hackers injected URLs containing specific keyword patterns in the URI path, add this rule:
Apache
RewriteEngine On
RewriteCond %{REQUEST_URI} casino [NC]
RewriteRule .* - [R=410,L]Apache
RewriteEngine On
RewriteEngine On
RewriteCond %{QUERY_STRING} ^p= [NC]
RewriteRule .* - [R=410,L]Click Save Rewrite Rules.
Step 3: Restart OpenLiteSpeed
OpenLiteSpeed requires a service reload or restart to apply virtual host rewrite changes immediately. You can do this directly from your CyberPanel interface or via your Ubuntu terminal:
Bash
systemctl restart lsws
Step 4: Clear CDN and Edge Caches
systemctl restart lswsStep 5: Verify the Fix
Return to your Ubuntu terminal and re-run your curl command:
Bash
curl -I https://yourdomain.com/infected-url-path/
You should now see the proper status returned at the very top:
HTTP
curl -I https://yourdomain.com/infected-url-path/Stop clicking “Validate Fix” for every individual error in Google Search Console. Validation forces Googlebot to re-crawl thousands of pages, wasting resources.
HTTP/2 410 GoneHandling persistent malware architecture, server-level rewrite tuning, and complex Search Console de-indexing requires deep technical expertise. If your team needs assistance auditing your server security and restoring your organic search traffic, reach out to DigmLabs for an expert technical audit.
