![]() |
| Frontier Tutorials / Writing an ObjectNotFoundHandler / Mode 2 Example |
A redirect is accomplished by calling mainResponder.redirect or by throwing a redirect scriptError (generally faster).
Your script could either redirect to a fixed, hardcoded URL or calculate the new URL based on the values of lastNomad and remainingPath.
This is the simplest way for the ObjectNotFoundHandler script to work.
In this example, we will redirect to a page-not-found page with a site search form.
In your #tools table, create a script called "PageNotFoundRedirect". It should look like this:
|
|---|
At the top level of your site, set the value of "#objectNotFoundHandler" to the address of your new "PageNotFoundRedirect" script. PageNotFoundRedirect is now your objectNotFoundHandler script.
Again at the top level of your site, create a new wptext entry named "pageNotFound", with the following contents:
|
|---|
Now go back to your browser and reload the page ("http://localhost/onfhTutorial/notThere"). Your page should resemble the following:
|
|---|
Your "page not found" page can be as simple or complex as you like.