Random subdirectories under index.php


#1

I have a very simple php site which has recently been flagged by Google as being hacked. The problem seems to be that external links are being created to pages such as:

domain.com/index.php/random-number/random-string/

For example

domain.com/index.php/22/sdfuskfjh/

This loads the index.php file but without the CSS as the path is broken.

What I would like to do is have this result in a 404 error. Is the solution through an htaccess file or is there a simpler way?

I’ve tried just using

<?php echo "Hello world"; ?>

with the same result, so I don’t think it is an issue with the php code.

I haven’t had this problem on other hosting companies and I am at a loss.


#2

I’d check your files on the server. Google doesn’t flag a hack because CSS or HTML is broken. Your site possibly has files that are generating malicious links.


#3

Thanks for the reply. That was my first thought but I have been through every line of every file (it really is a small simple site) and there is no malicious code. I’ve also checked the html of a page Google flagged as being hacked and there appears to be nothing untoward. There are also no extra files on the server and the site does not use a database.