Question: Because of some reason my site stopped working. After that I have uploaded the backup which I had created earlier.

I am getting a "404 Not Found Error The resource requested could not be found on this server!"
getting this on every page except `index.php` and also not able to login into the admin panel.

I already cleared the cache memory and set the `is_active` option to 1 in `core_website`, `core_store` and `core_storegroup` tables in phpMyAdmin still getting an error... I've tried so many links to solve this issue but the problem didn't resolved till yet.

Answer: 
This most likely is a file ownership issue. You probably upload the Magento files as another user and the web server user can't access the files. You have to change ownership so the webserver user owns the files. 

First, you need to find out what user your webserver runs under. If your running Ubuntu, it's usually www-data. In that case, you simply go to your root directory at doing the following.

```
chown -R www-data:www-data magento

```

* chown is the change ownership command. -R means it recurses everything under the root folder. In this case, I assume Magento is the name of your directory.

Once you do that be sure to set permissions.

```
find . -type f -exec chmod 400 {} \;
find . -type d -exec chmod 500 {} \; 
find var/ -type f -exec chmod 600 {} \; 
find media/ -type f -exec chmod 600 {} \;
find var/ -type d -exec chmod 700 {} \; 
find media/ -type d -exec chmod 700 {} \;
chmod 700 includes
chmod 600 includes/config.php

```

Here is the [current link with more details.](http://devdocs.magento.com/guides/m1x/install/installer-privileges_after.html)

NOTE: Pay VERY close attention when reading through that link. You got to add a backslash at the end of the file commands before the semicolons.
Thanks after spending hours looking for a permission or apache issue, the simple fact that copying magento files from a Nautilus window into apache www is not correct.

There is a "hidden" `.htaccess` file that you cannot see. So either do a manual copy of the `.htaccess` file or extract directly into the `www/html/magento`. You can verify the hidden file using a sudo edit just to check if it exists. This corrected all the 404 errors even though `index.php` was visible in the browser.