After searching over internet four hours I found one thing. That it is not possible to make alias of the url because the site collections lie within same web application. So, that way was not possible for me.
The final solution is to create an HttpModule for web application that checks specific url, if it meets the condition then redirect that request to desired site collection.
Create one class library in the visual studio. And place the below code.
Below is the code which shows the logic for creating http module.
namespace DynamicModule
{
public class DynamicModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpContext context = application.Context;
string httpUrl = context.Request.Url.ToString();
if (httpUrl.Contains("/sites/team1"))
{
HttpContext.Current.Server.ClearError();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Redirect("http://www.google.co.in");
}
}
public void Dispose() { }
}
}
After writing the code build the solution and go to the dll file that is created after build.
Now go to the bin
folder of web application.
In my case below is the path:
C:\inetpub\wwwroot\wss\VirtualDirectories\8000\bin
Paste dll here.
Now open the web.config file of the web application and find tag.
Create one entry here like:
<add name="NameOfModule" type="Namespace.Class,Full dll name with culture and public key token/>
Enjoy....!!!
Hope this helps others too.