Hi Ellen,
You could potentially use a session cookie to track when someone had accessed a "root" URI like / or /index.htm. If someone makes a request to a non-root URI without the cookie, you could redirect them to a start page.
This would potentially block access to your site though for any client who didn't support cookies. I'd be particularly concerned about search engine spiders.
Here's an example iRule you could use for this. I'd try it on a test virtual server before considering it for production.
when HTTP_REQUEST {
Session cookie name used to track whether client has requested a root URI
set name "my_session_cookie_name"
URI to redirect clients to who haven't accessed a root URI before the current request
set redirect_uri "http://www.example.com/index.htm"
Track whether we need to insert a session cookie in the response
set insert_cookie 0
Check if request is to root document
switch [HTTP::uri] {
"/" -
"/index.htm" {
Insert a cookie in the response, if client doesn't have one already
if { [HTTP::cookie $name] eq "" }{
Track that we need to set a session cookie in the response
set insert_cookie 1
}
}
default {
Non-root page, so check for cookie
if { [HTTP::cookie $name] eq "" }{
HTTP::redirect $redirect_uri
}
}
}
}
when HTTP_RESPONSE {
Insert a session cookie if the client accessed a root URI and didn't have a cookie already
if { $insert_cookie }{
HTTP::cookie insert name $name value "1" path "/"
}
}
Aaron