For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Serkan_HL_16562's avatar
Serkan_HL_16562
Icon for Nimbostratus rankNimbostratus
Aug 03, 2014

Help Please

i want to change url with irule

 

for example;

 

https://www.abc.com/1234.aspx to https://www.abc.com ( i want to remove url extension)

 

please help me.

 

tnx.

 

2 Replies

  • It's important to understand that a URI will always exist, even if it's just "/". So the simplest approach may simply be to change the URI:

    when HTTP_REQUEST {
        HTTP::uri "/"
    }
    

    This will change the URI transparently (the client won't see the change). If you do actually want the client to see the change, then something like this:

    when HTTP_REQUEST {
        if { not ( [HTTP::uri] equals "/" ) } {
            HTTP::redirect "/"
        }
    }
    

    Be forewarned though that both methods can have consequences. If the application isn't designed to handle these changes, or perhaps the application has other URIs that shouldn't be rewritten, then the iRule could get a bit more complex. If you just want to hide the "/1234.aspx" URI from the client, that may not be easy. What if other URIs exists (ex. /5678.aspx, /images/mycat.png, etc.)? You have to have a way for the client to indicate what it wants.

  • Hi Kevin,

     

    Thank you for your help. I tried your script you sent. this script is running. but website content is not displayed.

     

    I want exactly this: https://www.abc.com/1234.aspx to(remove from / after) https://www.abc.com exactly i want to just remove 1234.aspx.

     

    I hope I could explain it to you.

     

    best regards tnx.