“The requested URL index.php was not found on this server.” Error on Joomla

A new international client called us very early in the morning today and told us that he was seeing the following error when trying to access his website:

“The requested URL index.php was not found on this server.”

We immediately checked the problem and we noticed that the error was on every page – so it meant one of the following:

  • The index.php was mistakenly (or maliciously) deleted.
  • The index.php file cannot be read by the webserver because of permission issues (for example, the permissions on the index.php file are “000” [yes, we’ve seen this happen before, but the displayed error was different though]).

  • There is a problem with the .htaccess file.

Naturally, the first thing that we did was that we ssh’d to the server and checked the index.php file. Everything seemed OK: the file was there, its permissions were correct (they were set to “444”), and the content of the (core) file hasn’t been modified.

So we then checked the .htaccess file, and we didn’t find anything wrong with it. It seemed like the default .htacess with no modifications whatsoever.

Hmmm…

Our next approach was to check whether the index.php file is being loaded and so we added the following line to its beginning (immediately after the opening PHP tag):

die('Under maintenance...');

We then tried to browse to the website but we got the same error. This of course means that Apache is not even loading (or trying to load) the index.php file.

So we started thinking, what could have changed from a few hours ago (the client told us that the problem happened a couple of hours before calling us)? To answer our question, we ran the following command in the shell:

find /home/[user]/public_html -path '/home/[user]/public_html/cache/*' -prune -o -mtime -1 -ls

(The above command will list all the files that were changed in the past 24 hours)

And we got the following:

1573337 152 -rw-r–r– 1 [user] [user] 2859 Apr 30 07:22 /home/[user]/public_html/.htaccess

Aha! So the .htaccess file was modified! Naturally, we took another, thorougher, look at the .htaccess file and we noticed that this line:

# RewriteBase /

has been changed to this:

RewriteBase /

(The sharp is missing from the second line, which means that the line was uncommented.)

And so we re-added the sharp sign (or hash, or the number sign, or whatever people are calling it these days), and then we checked the website, and guess what? It was working! Woohoo! The client later told us that he did make this modification to address another problem, but he didn’t think that it might cause this kind of destruction!

So, the next time you see that error on your website, a good idea would be to check for these 3 things: the presence of the index.php file, the permissions on the index.php file, and the presence of the sharp (#) sign next to RewriteBase / in your .htaccess file. If you still can’t find the problem, then go ahead and contact us. We will solve your problem in as little time as possible and you will only have to pay our super affordable fees!

No comments yet.

Leave a comment