none
SharePoint site redirect RRS feed

  • Question

  • Hello,

    One of the user has following requirement.

    He has his SharePoint site e.g. http://xyz/sites/sitecollection. what he wants that when he types in the browser "sitecollection", he should be redirect to http://xyz/sites/sitecollection 

    Can any one give me some idea how do i do that? I'm expecting some more users will come up with the same requirement for their own sharepoint site. 

    we have SP2010 / IIS 7.

    Please help.

    Thanks,


    • Edited by abc67 Wednesday, March 28, 2012 11:58 PM
    Wednesday, March 28, 2012 11:17 PM

Answers

  • You can implement this directly in IIS.  Create a new IIS web site that responds to "sitecollection".  Under the Features, go to HTTP Redirection.  Check the Redirection checkbox and enter http://xyz/sites/sitecollection.  Check the checkbox "Redirect all requests to exact directory" and give it a Status Code of "Found (302)".

    This avoids having to use any html, asp, etc. to perform the redirect.


    http://sharepoint.nauplius.net

    • Proposed as answer by Aviw_ Thursday, March 29, 2012 2:27 PM
    • Marked as answer by Qiao WeiModerator Thursday, April 5, 2012 11:09 AM
    Thursday, March 29, 2012 1:53 AM
    Moderator
  • You can do this with the IIS redirect module, Which is a free download from microsoft.  Note this is not the same technique discussed in the previous post.  There's also a commercial product called 'Sharepoint Tiny Url'

    Nate

    Thursday, March 29, 2012 2:03 AM
  • There are multiple ways to do this such as using vanity URLs. Please check this blog to see how to accomplish this:

    http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=48

    Thursday, March 29, 2012 2:16 PM
  • Hi adc67.

    I doubt that there is any way to acomplish this within SharePoint, but if you concider it, it can be done. What you are saying is that the user will type only sitecollection in the address, then he will be automatically redirected to the site collection with its full URL.

    http://sitecollection -> http://xyz/sites/sitecollection

    'Sitecollection' when the user types it, needs first to be in the DNS, else the address can never be resolved to a host/ip address.
    Second, every 'Sitecollection' will need to have its own website in IIS. If every 'Shortaddress' has its own IIS web and that web holds one page by default, a redirectpage, than the user will be redirected to the full URL.

    I can't see that there is any other way to solve it. SInce 'Sitecollection' is a root address, it can't be done in any other way that I know of.

    The redirect page:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Your Page Title</title>
    <meta http-equiv="REFRESH" content="0;url=http://xyz/sites/sitecollection"></HEAD>
    <BODY>
    Optional page text here.
    </BODY>
    </HTML>

    (the 0 is for the number of seconds until redirect will take place)
    Hope this helps.

    Regards


    Thomas Balkeståhl - Technical Specialist - SharePoint - http://blog.blksthl.com
    Download the SharePoint Branding Project here


    Thursday, March 29, 2012 12:31 AM
  • Thanks to all of you. I have created new IIS website configure it as a redirect. That is working for me. Thanks again for your help.
    • Marked as answer by abc67 Sunday, April 8, 2012 9:51 PM
    Sunday, April 8, 2012 9:51 PM

All replies

  • Hi adc67.

    I doubt that there is any way to acomplish this within SharePoint, but if you concider it, it can be done. What you are saying is that the user will type only sitecollection in the address, then he will be automatically redirected to the site collection with its full URL.

    http://sitecollection -> http://xyz/sites/sitecollection

    'Sitecollection' when the user types it, needs first to be in the DNS, else the address can never be resolved to a host/ip address.
    Second, every 'Sitecollection' will need to have its own website in IIS. If every 'Shortaddress' has its own IIS web and that web holds one page by default, a redirectpage, than the user will be redirected to the full URL.

    I can't see that there is any other way to solve it. SInce 'Sitecollection' is a root address, it can't be done in any other way that I know of.

    The redirect page:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title>Your Page Title</title>
    <meta http-equiv="REFRESH" content="0;url=http://xyz/sites/sitecollection"></HEAD>
    <BODY>
    Optional page text here.
    </BODY>
    </HTML>

    (the 0 is for the number of seconds until redirect will take place)
    Hope this helps.

    Regards


    Thomas Balkeståhl - Technical Specialist - SharePoint - http://blog.blksthl.com
    Download the SharePoint Branding Project here


    Thursday, March 29, 2012 12:31 AM
  • You can implement this directly in IIS.  Create a new IIS web site that responds to "sitecollection".  Under the Features, go to HTTP Redirection.  Check the Redirection checkbox and enter http://xyz/sites/sitecollection.  Check the checkbox "Redirect all requests to exact directory" and give it a Status Code of "Found (302)".

    This avoids having to use any html, asp, etc. to perform the redirect.


    http://sharepoint.nauplius.net

    • Proposed as answer by Aviw_ Thursday, March 29, 2012 2:27 PM
    • Marked as answer by Qiao WeiModerator Thursday, April 5, 2012 11:09 AM
    Thursday, March 29, 2012 1:53 AM
    Moderator
  • You can do this with the IIS redirect module, Which is a free download from microsoft.  Note this is not the same technique discussed in the previous post.  There's also a commercial product called 'Sharepoint Tiny Url'

    Nate

    Thursday, March 29, 2012 2:03 AM
  • SharePoint does not support this type of URL Rewrite behavior.  The op will need to use a separate IIS site or a coded redirect method using a separate site.

    http://sharepoint.nauplius.net

    Thursday, March 29, 2012 2:04 AM
    Moderator
  • There are multiple ways to do this such as using vanity URLs. Please check this blog to see how to accomplish this:

    http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=48

    Thursday, March 29, 2012 2:16 PM
  • Thanks to all of you. I have created new IIS website configure it as a redirect. That is working for me. Thanks again for your help.
    • Marked as answer by abc67 Sunday, April 8, 2012 9:51 PM
    Sunday, April 8, 2012 9:51 PM
  • Hi Trevor,

    My question is simple...can we redirect existing on premise URL to Office365 URL's site collection?

    We have more than 800 site collections...is this possible at IIS level for each site collection or some other good solution?

    Thursday, June 23, 2016 12:53 AM
  • You could use HTTP 302s. This can be accomplished through URL Rewrite or through IIS. You would have to redirect, for example, http://portal.example.com/sites/mysite to https://tenantName.sharepoint.com/sites/mysite.

    I would personally do this a service other than IIS, if possible (e.g. Azure Web Site or if you have a load balancer that can do this).


    Trevor Seward

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Thursday, June 23, 2016 1:02 AM
    Moderator
  • Thanks Trevor for reply....Is this possible from our on prem to O365?

    http://portal.example.com/sites/dept1  to  (https://tenantName.sharepoint.com/sites/dept1)

    http://portal.example.com/sites/dept2  to  (https://tenantName.sharepoint.com/sites/dept2)

    http://portal.example.com/sites/dept3  to  (https://tenantName.sharepoint.com/sites/dept3)

    1. Is URL Rewrite or through IIS are two different things?
    2. Do we need to rewrite URL for all 800 sites?

    Thursday, June 23, 2016 3:03 AM