Change error page by file type?

Hello,

If someone makes a request for a .js file from our server and no such
file exists, I would like to return a different error page (actually an
error.js page) in response. Yet if they request a .htm page I want to
use a different error page (notfound.htm). Is this possible? If so can
you please show an example configuration file snippet to do this? Thank
you!

On Thursday 15 May 2008, Rt Ibmer wrote:

If someone makes a request for a .js file from our server and no such file
exists, I would like to return a different error page (actually an error.js
page) in response. Yet if they request a .htm page I want to use a
different error page (notfound.htm). Is this possible? If so can you
please show an example configuration file snippet to do this? Thank you!

location ~ .js$ {
error_page 404 /errors/error.js;
}

location ~ .htm$ {
error_page 404 /errors/notfound.htm;
}

location /errors/ {
#nothing here
}

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs