I'm not sure where to ask this Question - here, SO, Webmasters.SE, somewhere else? Please migrate if appropriate.
tl;dr:
The following rule in my .htaccess is causing Sucuri's free online scanner to report my site as infected with:
"Known javascript malware" - Location: http://my-subdomain.cu.cc/404testpage4525d2fdc/
("my-subdomain" is not my real sub-domain).
Here's the rule:
RewriteRule ^([^\.]+[^/])$ http://%{HTTP_HOST}/$1/ [L]
Question
Is there anything inherently wrong with my RewriteRule, am I somehow "doing it wrong"? Or, is this just much ado about nothing?
Background
I'm using that RewriteRule to add a slash to any URL's that don't have a trailing slash - except URL's pointing to a file, e.g., index.php, myfile.html, etc.
It's very consistent and reproducible...if I comment out that rule and rescan, it's clean; re-enable, flagged again...ad nauseum. I can think of three possibilities (though I'm sure there are more):
- a flaw in their scanning process;
- something inherently wrong with that RewriteRule;
Sucuri is trying to drum up business from the unsuspecting;(Author edit)
In my .htaccess I also have:
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$ [NC]
RewriteRule ^(.*)$ /mydomain/$1 [L]
That rewrites any requests to mydomain.com
to a sub-directory of my public root (which I'll just call root, for brevity's sake). This is needed because I have a shared hosting account that allows unlimited domain addons, but they all must point to root. Those two lines are replicated 7 other times, all rewriting different domains to different sub-directories.
Finally, I have:
#block access to .inc files sitewide
<Files ~ "\.inc$">
Order allow,deny
Deny from all
</Files>
That one should be self-explanatory. Prior to my scan, I had only one file in root - .htaccess. Everything else is in sub-directories - each sub-directory is dedicated to a different domain, hence my RewriteRules.
After reading some threads re: WordPress malware problems, I decided to run their scanner and check my site. So I created a dummy index.php in root, shown here in its entirety:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
Root!
</body>
</html>
I used one of my unused freebie CU.CC sub-domains to use with their scanner. That sub-domain is not in my .htaccess
, so it automatically points to root.
Edit
This is the error page for http://my-subdomain.cu.cc/404testpage4525d2fdc/
Not Found
The requested URL /404testpage4525d2fdc was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at anchorage.cu.cc Port 80