Forum Discussion
dgloff_22332
Nimbostratus
Jun 25, 2012Truncate an URL
Hello,
I had an SEO project dropped on my desk that I'm fairly certain can be done via an iRule, but I'm not sure how to handle the truncation. Basically, they're looking to redirect all re...
dgloff_22332
Nimbostratus
Jun 25, 2012To complicate things further, after getting the above working, Marketing informed me that they wanted a 301, not a 302. So I've changed it to the following:
when HTTP_REQUEST {
if { [string tolower [HTTP::uri]] contains "/default.aspx" } {
set replaceURI [string map [list /default.aspx /] [HTTP::uri]]
HTTP::respond 301 Location "$replaceURI"
}
elseif { [string tolower [HTTP::uri]] contains "/default.asp" } {
set replaceURI [string map [list /default.asp /] [HTTP::uri]]
HTTP::respond 301 Location "$replaceURI"
}
}
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects