1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Rewriting URLs

Rewriting URLs

9 posts, 1 answered
  1. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    14 Aug 2009
    Link to this post
    Is there a way i can make parts of my system look like it is on a different subdomain?

    Imagine this is my domain: www.mydomain.com

    And i have pages like this:

    www.mydomain.com/home.aspx
    www.mydomain.com/about.aspx
    www.mydomain.com/books.aspx
    www.mydomain.com/books/home.aspx
    www.mydomain.com/books/products.aspx

    Now i would like to either allow someone to type in books.mydomain.com or www.mydomain.com/books and havd the system go directly to www.mydomain.com/books/home.aspx 

    Is there a way to do this?
  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    14 Aug 2009
    Link to this post
    Hi Andrew,

    Actually, there is a new “Domain – Page mapping” feature in the Sitefinity 3.7. We will post a KB about it soon, but your request got ahead of it.

    This feature allows you to map a specific CMS page in the Web Site to a specific domain. So when the site is accessed via that domain, the mapped CMS page behaves as a root of the site.

    In your case, you should add the following mapping in the telerik/cms section in the web.config:

        <cms defaultProvider="Sitefinity" pageExtension=".aspx" ...> 
          <urlMappings> 
            <add key="books.mydomain.com" value="books" shared="true" /> 
          </urlMappings> 
          ... 
        </cms> 

    I think, you should also make the books page a Group Page in the page properties.

    After doing the above, when you access the site via books.mydomain.com, it will redirect you to www.mydomain.com/home.aspx, which will be actually ~/books/home.aspx.

    Note, that the shared attribute is true (its default value is false). This means that the page books will be visible and accessible for the other domains.

    Actually this feature is not limited only with this functionality, you will see the other applications in the upcoming KBs.

    Hope this is helpful.
    Please do let us know if you have any questions.

    Kind regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    18 Aug 2009
    Link to this post

    Thanks Vlad.

    I will upload a test site to my production server and try this out.
    Also, looking forward to the KB posting to see what else we can do with this new functionality.

  4. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    19 Aug 2009
    Link to this post
    Hello Andrew,

    Actually you can test this on your local PC.
    Here is the link to the KB:
    http://www.sitefinity.com/support/kb/sitefinity-3-x/the-“domain-–-page-mapping”-feature.aspx

    You can find useful the paragraph about testing this feature.

    Best wishes,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
    Answered
  5. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    19 Aug 2009
    Link to this post
    Ok, almost there. It does something. it has disbled access to the areas i set to be shared=false.
    So something is happening.
    Unfortunetely. I am having a bit of a problem testing localy.
    I have had this before that's why my original idea was to test while it is up on production.
    Perhps you can help with that.

    Basically i set the host file like this:
    127.0.0.1 books.mysite.com
    127.0.0.1 test.mysite.com

    Now however, when i type in books.mysite.com it simply opens my the default IIS page, as i guess is to be expected.
    Considering the actual site is: http://localhost/mysite/
    therefore i need it to go to : http://localhost/mysite/books/home.aspx
                                        not:  http://localhost/

    Which is where the mapping above would take me.

    Do you know how i need to change the mapping?
    I am using vista and IIS7

    Thanks
  6. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    19 Aug 2009
    Link to this post
    Hi Andrew,

    I am not sure if I understand your question: "Do you know how i need to change the mapping?"
    Which mapping do you mean?

    As your site is http://localhost/mysite/, so the domain is localhost.

    After adding those domains in the hosts file, you should be able to access the site with:
    http://books.mysite.com/mysite/
    http://test.mysite.com/mysite/

    Alternatively, in the IIS7 you should be able to create Web Sites (not a virtual directory). You can create a Web Site, pointing to the site physical folder, on different port, i.e. 8888. In this case, the site will be accessible with:
    http://localhost:8888
    http://books.mysite.com:8888
    http://test.mysite.com:8888

    Hope this will help.

    Best wishes,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    19 Aug 2009
    Link to this post
    Of course.
    In my haste i did not really think.
    For some weird reason i tried to type in: books.mysite.com/books instead of books.mysite.com/mysite.
    Such an obvious thing of course.

    Thanks for all your help.

    Works like a dream. Exactly what i wanted.
  8. Jacques
    Jacques avatar
    427 posts
    Registered:
    28 Jun 2007
    01 Feb 2010
    Link to this post
    Is this available in 3.6? And if not, how can we achieve the same affect?
  9. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    02 Feb 2010
    Link to this post
    Hi J.Hov,

    Thank you for using our services.

    This feature has been implemented in version 3.7. In order to achieve the same effect you will have to implement some custom logic. You can find the code needed in the following forum thread: Sub domains...

    Sincerely yours,
    Radoslav Georgiev
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Register for webinar
9 posts, 1 answered