Forum Discussion
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.
- Jad_Tabbara__J1
Cirrostratus
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
- Eric_Flores_131
Cirrostratus
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.
- hantanviet_3337
Nimbostratus
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.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com