Drupal shows only front page

Trocaqui has gone "mad".
It was working fine and, suddenly, it started to show the front page, no matter what link I selected nor what address I inserted in the address bar...
This was so critical that I could't even login into the system to put the system on maintenance mode while fixing the problem...

I've researched and it look to be an Apache mod_rewrite problem.
It started to look like a clean URL problem so I decided to try the non-clean URL format and voilá, Drupal started to responde correctly...
Using the /?q= format I was able to login, set the system in maintenance mode and disable the clean URL format.
By now, I was at least able to manage it.

When in a similar situation, just change the clean URL with the standard Drupal format, it's actually quite easy. Just insert a ?q= between the first / and the following character.
Here's an example: http://www.trocaqui.net/forum is equivalent to http://www.trocaqui.net/?q=forum.

While this was good enough as a starting point, it was not the best solution, thus I continued the quest for the real solution.

I cloned the production site on my testing environment and was able to reproduce the problem, which is a great first step.
While analyzing the problem, I've found out that my .htaccess was broke and tried to fixed it following the steps of others that had .htaccess and Clean URLs problems.
Once the clean URLs were disables, I was unable to set them on again since Drupal tests clean URLs and only allows them to be activated if they will work.

Here's what worked for me, I edited the .htaccess and fixed things by setting the following:
  • RewriteEngine ON
  • RewriteRule "(^|/)\." - [F]
  • RewriteBase /
  • RewriteCond %{REQUEST_FILENAME} !-f
  • RewriteCond %{REQUEST_FILENAME} !-d
  • RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Have special attention to the RewriteEngine ON, it may be case sensitive.

I hope this is helpful for others with a similar problem.
./M6