We are currently running Sharepoint to host our public website. When the user types in www.company.com the URL gets updated to www.company.com/Pages/Home.aspx. This also applies to all other sites within it like www.company.com/Pages/Marketing (with several other flavors).
What I want is an iRule that will see if the user is going to www.company.com. Then change it to a HTTP respond 301 and to lower all strings. So instead of seeing www.company.com/Marketing.aspx they will get www.company.com/marketing.aspx.
Here is an irule that I have tried and does the 301 part, but it always implies the site is just www.company.com. I want to a /* somehow so that any site it sees, it lowers it and does a 301 redirect. here is my curreny rule.
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"www.company.com" {
HTTP::respond 301 Location "https://www.company.com[HTTP::uri]"
}
I want it to see if it is www.company.com and if so anything added past the / when it gets added to the particular link it recognizes it.
I assume your SharePoint site is issuing the responses with uppercase characters? A redirect may not work for what your are trying to accomplish. Are you just trying to make it so a URLs that show up in the browser are all lower case? If that’s the case a stream profile for the response may be the best solution.
Yes, but I also want it to do 301 redirect instead of a 302. I tried the iRule you posted before you deleted it, but just cased a huge loop.
Yeah, that’s why I removed it I saw the problem that was going to create.
How about this?
when HTTP_RESPONSE {
if {[HTTP::status] == 302}{
HTTP::respond 301 Location "[string tolower [HTTP::header Location]]"
}
}
How about this?
when HTTP_RESPONSE {
if {[HTTP::status] == 302}{
HTTP::respond 301 Location "[string tolower [HTTP::header Location]]"
}
}
That worked like a champ. Really appreciate it.
That worked like a champ. Really appreciate it.
I was wondering what would I need to do to find another http status? Some of the sites use 200 requests and would like to make it and if this or if that.
I was wondering what would I need to do to find another http status? Some of the sites use 200 requests and would like to make it and if this or if that.