# Solved: .htaccess redirect 404 to search



## firestormer (Sep 16, 2005)

I know how to use ErrorDocument 404 ... in htaccess to create a custom 404 page but is it possible to redirect to my sites search engin and use the name of the missing file in the search engine?

This is a standard seach for the word Hello:

/search/index.php?string=*Hello*&match=all

so i need to replace the Hello in htaccess to some veriable which represents the file the user was looking for. so ie:

/*somemissingfile*.html --> //search/index.php?string=*somemissingfile*&match=all

or /*somemissingfile* --> //search/index.php?string=*somemissingfile*&match=all


----------



## firestormer (Sep 16, 2005)

Again im just too good. SOLVED!


```
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ([^/\.]+).php$ /test/webb/search/index.php?string=$1&match=all [L]
```


----------

