Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

Redirect Many urls to homepage

Hello , I have a list of many urls on my website which getting 404 error. I want only the list of the urls to redirect to homepage [ not all the pages on website ] found how to do it for a specific links , but is there anyway to do this with data group list so it can be easier just to put the links and not repeat the command 500 times in the irule?

Thank you.

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hello Chenco,

Create a "String" type data group (in this example dg-404-URIs) add URIs that gets 404 responses status and add the following part to the irule :

when HTTP_REQUEST {

  set uri [HTTP::uri]
  #log local0. "DEBUG $uri"

}

when HTTP_RESPONSE { 
  if { [HTTP::status] eq "404" } {
  if { [matchclass dg-404-URIs eq $uri] } {
    HTTP::respond 302 noserver "Location" "https://page.toto.com/" "Connection" "Close"
  }
  }
}

Hope it helps

Please mark it as answer if it works

Regards

1
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hello Chenco, If you have a fairly new version of TMOS, I would suggest using LTM policies as they are a native TMM feature (written in C) much more performant for basic HTTP redirects than TCL.

https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/bigip-local-traffic-policies-getting-started-13-0-0/1.html

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

i think you can change file htaccess in hosting. that is you configure http 404. i do not trying, but you can reseaching google. my website about printing business card, in photobook,before when i setup, i had meet some cases.

0