Forum Discussion
set Response_Redirect Question
Hi,
We have a Wordpress site that I would like to redirect requests for the admin pages to another location, I have an iRule that looks like this:
when HTTP_REQUEST priority 10 {
unset -nocomplain request_already_responded
switch -exact -- [string tolower [HTTP::path]] "/wp-admin" - \
"/wp-login.php" {
set Response_Redirect "http://www.asite.com/"
} default {
set Pool_Name Pool_Live_newsroom_HTTP80
}
}
Where the URL is:
blog.asite.com/en/xxx/
Its pretty simple so I am wondering what on earth is wrong with it!
Thanks in Advance
James
3 Replies
- Hannes_Rapp
Nimbostratus
Your current iRule does not do anything besides consuming memory. Are you sure you've pasted everything?
Try something as below:
when HTTP_REQUEST { switch -glob [HTTP::uri] { "*/wp-admin" - "*/wp-login.php" { HTTP::respond 302 location "http://www.asite.com/" event disable TCP::close Forces a temp redirect to a given location (non-cacheable). Instructs F5 to stop processing the HTTPrequest event. The TCP connection record will be removed from the connections table. } default { pool Pool_Live_newsroom_HTTP80 Instructs F5 to select a pool specified. Assuming this is the same as your VS default pool, this section can be removed from the iRule. } } } - JTucker_137331
Nimbostratus
Hi,
I will give that a shot, apart from some comments yes, that is all, none of the VS's have a default pool, it's all handled by the iRule.
- JTucker_137331
Nimbostratus
Implemented and works a treat, thanks!
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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
