Rewrite specific URL in SharePoint 2013
Hello,
I would like to rewrite a specific SharePoint 2013 URL from one web appplication SharePoint to another one using the LTM module on a Big-IP.
For example, the URL https://www.abc.com/siteRewrite will be rewritten to https://www.xyz.com/siteRewrite. The end user must not see the new url meaning at any time he will see https://www.abc.com/siteRewrite. The root site https://www.abc.com/ need to stay available for the user.
I have tried to do that using iRule (rewrite iRule and ProxyPass iRule). The problem is that the website is well rewritten but the content inside doesn't display properly some images, links, folders .... are missing.
You will find below the rewrite iRule used (the proxy pass iRule I have tested is the one available on the F5 website).
when HTTP_REQUEST
{
if { ("[string tolower [HTTP::host]][HTTP::path]" starts_with "www.abc.com/siteRewrite/") } {
HTTP::header remove "Accept-Encoding"
HTTP::header replace Host "www.xyz.com"
STREAM::disable
}
}
when HTTP_RESPONSE {
if { [HTTP::is_redirect] && [string tolower [HTTP::header "Location"]] contains "www.xyz.com" } {
HTTP::header replace Location [string map {"www.xyz.com" "www.abc.com"} [HTTP::header Location]]
}
if { [HTTP::header "Content-Type"] starts_with "text/" } {
STREAM::expression "@www.xyz.com@www.abc.com@"
STREAM::enable
}
}
Do you know why the content is not rendering properly ? Is something missing in the iRule ? Is the APM module required for this ?
If I have a look at the web page I see 404 error (not found) on some .axd resources (ScriptResource.axd, WebResource.axd). I think the problem is linked to these SharePoint resources and the root context (because rewritting the entire website www.abc.com to www.xyz.com is working).
Is someone have an idea about it ?
Thanks