ErrorDocument pages and Sandvox

An iritating problem with Sandvox is that is doesn’t appear to allow a page to be setup with absolute references pointing at the local site.

This causes a problem when create DocumentError pages for Apache, because the current references for a page aren’t changed with an error is generated.

For example:

  • Assume ErrorDocument 404 /404_errorpage.html in the .htaccess file, causing the page /404_errorpage.html to be opened in the event of a page not found error.
  • If a page /non_existent_folder/non_existent_page.html/non_existent_folder/ is selected by the browser, causing a 404 error to be generated. All relative references in the error page, would contain /non_existent_folder/ before the relative reference.

This means that if a style sheet or page menu links don’t have an absolute reference then they’re all broken.

Sandvox only appears to provide relative links in any page it controls. So either you create static pages, and manually maintain them or …  well I created a clunky workaround.

HTML has a handy capability to allow a page to be automatically refreshed to an alternative location, using a meta tag that is placed in the header of a HTML file. 

For example:

<meta http-equiv=“refresh” content=“0; URL=/redirect_page.html”>

Note: just in case the browser doesn’t interpret this tag, it is advisable to include a <body> with some useful information.

So the fix for my problem with Sandvox is to create a jump page for each of the error conditions that need to be trapped. This jump page is then redirects to the full URL of the associated page controlled by Sandvox. Hey presto all the links work. 

As I said it was clunky but it does appear to work.

This entry was posted in Apache, Apple, Diary. Bookmark the permalink.