Forum Discussion
3 Replies
- Mohamed_LrhaziAltocumulus
Yes, there is... Just identify the requests that represent full page as opposed to those that represent page component :)
Maybe "full page" is only these:
/ /index.html /index.php /products /products/ /products/index.htm
- Kevin_StewartEmployee
You could go either I think, but you'd more or less have to define all page objects or all non-page objects, or at least object extensions. Here's an example that defines non-page objects from a data group.
when HTTP_REQUEST { if { [class match [string tolower [HTTP::uri]] ends_with objectlist] } { set do_not_err 1 } } when HTTP_RESPONSE { if { [info exists do_not_err] } { unset do_not_err return } elseif { ( [HTTP::status] starts_with "40" ) or ( [HTTP::status] starts_with "50" ) } { HTTP::respond 200 content "Broken" } }
where objectlist is a string-based data group that contains the lowercased extensions of known object types that you might encounter on a page. Example.
jpg gif png js css
- IheartF5_45022Nacreous
If you page 'breaks' when you get a redirect to a maintenance page for an includes-type object, then I suspect that it will 'break' when you get a 404. However to answer your actual question this should work;-
when RULE_INIT { List of well known 'page' extensions set static::l_ext [list "" "do" "htm" "html" "jsp" "asp" "aspx" "wml" "xhtml" "json" "cfm"] } when HTTP_REQUEST { Save variable for possible later use in HTTP_RESPONSE set request [HTTP::uri] } when HTTP_RESPONSE { if {[HTTP::status] == 404 && [lsearch $static::l_ext [string tolower [getfield [URI::basename $request] "." 2]]] != -1 } { HTTP::respond 302 noserver Location "http://mycomapny.com/sorry_404.htm" return }