0

It took me forever to figure out how to do this in CS 4, so I wanted to document what I did and see if anyone had any other suggestions to make this better:

The page is called stunt.aspx and it's physical location is /themes/movies/content/stunt.aspx.

The url it should display is http://domain.com/content/stunt.aspx, however a complication arises because the managers want to advertise the url as http://domain.com/stunt.aspx

Make a Placeholder File

The first step was to make a placeholder file in the root called stunt.aspx

The page code looks like this (I copied it from another redirecting page):

<%@ Page  %>

<%-- 

This page is a placeholder for URL rewriting.

--%>

SiteUrls_Override.config

In the SiteUrls_Override.config I added an entry to tell CS where the physical page was and what the short url should be. I store all of my /content/ definitions in SiteUrls_Override.config, but I think you could put it in SiteUrls.config if you're careful.

<location name="content" path="/content/" themeDir="content">
    <url name="contentpart_stunt" path="stunt.aspx" pattern="stunt.aspx" vanity="{2}" physicalPath="##themeDir##" page="stunt.aspx" />
</location>

SiteUrls.config

In the SiteUrls.config, under the section for root pages, <location name="common" path="/" themeDir="common" >, I added this entry:

<url name="redirect_stunt" path="/" pattern="stunt.aspx" vanity="{2}" redirect="true" physicalPath="/content/" page="stunt.aspx" />

Important pieces in this line

redirect="true"
physicalPath="/content/"

these lines tell it to redirect and where to.

More Info: http://docs.communityserver.com/customization/understanding-the-siteurls-config-file/

flag

Your Answer

Browse other questions tagged or ask your own question.