Forum Discussion
Hai_Le_36697
Nimbostratus
Sep 24, 2010redirect wwwX.domain.com to www.domain.com
Hey guys,
I'm pretty new to iRule and this forum has really helped me get to where I am; however, I am stuck and I hope you guys can help. What I would like to do is to extract the domain ...
Hai_Le_36697
Nimbostratus
Sep 25, 2010Hi aaron,
I want to give you the full story. The reason I am writing this iRule is to redirect bots like Googlebot to the correct URL. www3 and www10 are our backdoor virtual hosts and I don't want bots to index them (which they are). With that said, I did take both of your suggestions with my latest attempt. Here it is:
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::host]] {
"www2.*" -
"www3.*" -
"www10.*" {
switch -glob [string tolower [HTTP::header User-Agent]] {
"googlebot*" -
"mediapartners*" -
"msnbot*" -
"slurp*" -
"ia_archiver*" -
"zyborg*" -
"askjeeves*" {
HTTP::respond 301 Location "http://www.[domain [HTTP::host] 2][HTTP::uri]"
}
}
}
}
}
So basically, if the the request is for www2, www3, or www10 and the agent is an identified bot, then do a 301 redirect to www, otherwise don't do anything.
I manage the dns for my domains and I know that I only use ww2, www3, and www10 so the first switch would work perfectly.
We just want to increase our www page ranks in google and other search engines by redirecting all the www2, www3, and www10 hosts.
I hope that makes more sense. Sorry for not filling you in on the full story... I just didn't want to add confusion to my current problem with extracting the domain from HTTP::host
Any comments would be greatly appreciated.
Hai
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