Forum Discussion
4 Replies
Sort By
- nitassEmployee
the problem is if someone has bookmarked a location for instance for redirect/shared documents/document1. It needs to go to documents/document1.
e.g.
configuration [root@ve11a:Active:In Sync] config tmsh list ltm virtual bar ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 pool foo profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } vs-index 19 } [root@ve11a:Active:In Sync] config tmsh list ltm rule qux ltm rule qux { when HTTP_REQUEST { if { [HTTP::uri] starts_with "/projects/test_for_redirect/" } { set newuri [string map {/projects/test_for_redirect/ /sites/testforredirect/} [HTTP::uri]] HTTP::redirect "http://[HTTP::host]$newuri" } } } test [root@ve11a:Active:In Sync] config curl -I http://172.28.24.10/projects/test_for_redirect/shared_documents/document1 HTTP/1.0 302 Found Location: http://172.28.24.10/sites/testforredirect/shared_documents/document1 Server: BigIP Connection: Keep-Alive Content-Length: 0
- Roland_Hansen_1NimbostratusNot perfect but it definitely pointed me in the right direction. The problem is that most users put in the URL as something like http://mysite/projects/Test For Redirect with spaces and a mixture of capital and lower case letters. Here is the ultimate solution I came up with due to your excellent suggestion. when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/projects/test%20for%20redirect" } { set newuri [string tolower [string map {/projects/test%20for%20redirect /sites/testforredirect} [HTTP::uri]]] HTTP::redirect "http://[HTTP::host]$newuri" } }
- nitass_89166Noctilucent
the problem is if someone has bookmarked a location for instance for redirect/shared documents/document1. It needs to go to documents/document1.
e.g.
configuration [root@ve11a:Active:In Sync] config tmsh list ltm virtual bar ltm virtual bar { destination 172.28.24.10:80 ip-protocol tcp mask 255.255.255.255 pool foo profiles { http { } tcp { } } rules { qux } source 0.0.0.0/0 source-address-translation { type automap } vs-index 19 } [root@ve11a:Active:In Sync] config tmsh list ltm rule qux ltm rule qux { when HTTP_REQUEST { if { [HTTP::uri] starts_with "/projects/test_for_redirect/" } { set newuri [string map {/projects/test_for_redirect/ /sites/testforredirect/} [HTTP::uri]] HTTP::redirect "http://[HTTP::host]$newuri" } } } test [root@ve11a:Active:In Sync] config curl -I http://172.28.24.10/projects/test_for_redirect/shared_documents/document1 HTTP/1.0 302 Found Location: http://172.28.24.10/sites/testforredirect/shared_documents/document1 Server: BigIP Connection: Keep-Alive Content-Length: 0
- Roland_Hansen_1NimbostratusNot perfect but it definitely pointed me in the right direction. The problem is that most users put in the URL as something like http://mysite/projects/Test For Redirect with spaces and a mixture of capital and lower case letters. Here is the ultimate solution I came up with due to your excellent suggestion. when HTTP_REQUEST { if { [string tolower [HTTP::uri]] starts_with "/projects/test%20for%20redirect" } { set newuri [string tolower [string map {/projects/test%20for%20redirect /sites/testforredirect} [HTTP::uri]]] HTTP::redirect "http://[HTTP::host]$newuri" } }