Forum Discussion

Vishakh_Krishna's avatar
Vishakh_Krishna
Icon for Nimbostratus rankNimbostratus
Mar 15, 2015

irule for URL redirection and response content patience page

Dear Team, We have a URL which was decommissioned. However we didnt want to inform the users regarding the change of URL since it is kept as favourite for entire users.

 

DNS entry for decommisioned website was abc-uat-int.domain.ae DNS entry for new New website is pointed to abc-uat.domain.ae

 

so we created a Irule for URL redirection from abc-uat-int.domain.ae to abc-uat.domain.ae

 

Step 1: In the HTTP Virtual IP of old website abc-uat-int.domain.ae , We configured Irule as below: when HTTP_REQUEST { HTTP::redirect "https://abc-uat.domain.ae[HTTP::uri]" } Now redirection is happening properly as desired. However our requirement is, whenever user try to enter the old URL abc-uat-int.domain.ae, they should get a website patience page for 5 secs with an message Respond header should give message before the URL gets redirected from abc-uat-int.domain.ae to abc-uat.domain.ae "We are sorry, but the site you are looking for has been moved on https://abc-uat.domain.ae."

 

Please do the needful as i am not really sure of how to write irules for website respond content messages.

 

Thanks, Vish

 

7 Replies

    • Arie's avatar
      Arie
      Icon for Altostratus rankAltostratus
      I would recommend not using a meta-refresh since it's not (100%) reliable. In addition, it doesn't instruct clients (and search engines) to start using the new URL (like a 301 would). My recommendation for this situation would be to issue a 301 and then intercept the request to the new location (check the HTTP header "referer" for the referring (old) URL) to show the pop-up. That way you can have the 301 as well as the message to the visitor.
    • Arie's avatar
      Arie
      Icon for Altostratus rankAltostratus
      I would recommend not using a meta-refresh since it's not (100%) reliable. In addition, it doesn't instruct clients (and search engines) to start using the new URL (like a 301 would). My recommendation for this situation would be to issue a 301 and then intercept the request to the new location (check the HTTP header "referer" for the referring (old) URL) to show the pop-up. That way you can have the 301 as well as the message to the visitor.
  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    HTTP::redirect
    issues a 302 (Temporary Redirect). Since the URL has been decommissioned you will want to use a Permanent Redirect (301). Permanent redirects will instruct clients and search engines alike to go directly to the new location in the future.

    To get the iRule to issue a permanent redirect use:

    HTTP::respond 301 Location "http://www.newdomain.com/newpath"

  • Requirement is as below"

    When user types abc-uat-int.domain.ae, HTML holding webpage should appear with an message "We are sorry, but the site you are looking for has been moved on https://abc-int.domain.ae." for 5 seconds and then it should redirect to abc-int.domain.ae.

    Redirection is happening perfectly fine. just need a HTML holding page for 5 seconds with above message before it redirects. Please assist. I got some sample irule. Please let me know if it will work.

    when HTTP_REQUEST {

    HTTP::respond 302 content \
    

    "Apology pagehttp://www.domain.com/aba/>\

    We are sorry, but the site you are looking for has been moved on https://obs-uat.domain.ae.

    " "Content-Type" "text/html" set dtime 5 }