Question: Google has cached some old URLs to pages that no longer exist on a site. I'd like to redirect any 404 pages to the home page.

I have a jetty installation with a ROOT.war file installed in jetty/webapps. The ROOT.war file contains a WEB-INF/web.xml file that has the following in it:

```
<error-page>
    <error-code>404</error-code>
    <location>/</location>
</error-page>

```

However, this is only redirecting top level files, nothing in subdirectories. So the following URL get redirected to the home page:

```
http://mysite.com/pageDoesntExist.html

```

But this one doesn't and just gives a 404 error:

```
http://mysite.com/directoryDoesntExist/pageDoesntExist.html

```

Is there a way to configure all 404's to go to the home page? Can I do this in the jetty/contexts directory somehow?

Answer: 
```
select user_id, count(user_id) as count from table order by count desc group by user_id

```

something like that anyway...
```
SELECT COUNT(a.category_id) as cnt,b.category,b.image FROM bookings as a 
INNER JOIN service_category as b ON a.category_id=b.category_id 
GROUP BY a.category_id ORDER BY cnt DESC LIMIT 6

```