Forum Discussion

zeng_weiliang_2's avatar
zeng_weiliang_2
Icon for Nimbostratus rankNimbostratus
Apr 28, 2007

How to redirect the www.a.com to www.a.com/abc

If end user type an URL http://www.a.com to access a web server, but the default directory of web server is empty, how to write an iRule to redirect the web page to http://www.a.com/abc automatic so client can access another directory of web server?

2 Replies

  • You can use HTTP::redirect (Click here for the wiki page) to redirect clients that make a request for the root document to the /abc URI:

    
    when HTTP_REQUEST {
       if {[HTTP::uri] eq "/"}{
          HTTP::redirect http://[HTTP::host]/abc
       }
    }

    If the requested URI isn't /, the client request won't be modified and they will be sent to the pool.

    Aaron

    (Edited to add [] around HTTP::uri)