community-server+redirect Questions - SnippetGood most recent 30 from http://snippetgood.com 2010-09-07T04:36:43Z http://snippetgood.com/feeds/tag/community-server%2bredirect http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://snippetgood.com/questions/44/community-server-redirection-with-siteurls-config Community Server Redirection with SiteUrls.config binky 2009-10-06T15:42:01Z 2009-10-06T18:07:53Z <p>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:</p> <p>The page is called stunt.aspx and it's physical location is <code>/themes/movies/content/stunt.aspx.</code> </p> <p>The url it should display is <code>http://domain.com/content/stunt.aspx</code>, however a complication arises because the managers want to advertise the url as <code>http://domain.com/stunt.aspx</code> </p> <p><strong>Make a Placeholder File</strong></p> <p>The first step was to make a placeholder file in the root called <code>stunt.aspx</code></p> <p>The page code looks like this (I copied it from another redirecting page):</p> <pre><code>&lt;%@ Page %&gt; &lt;%-- This page is a placeholder for URL rewriting. --%&gt; </code></pre> <p><strong>SiteUrls_Override.config</strong></p> <p>In the SiteUrls<code>_</code>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.</p> <pre><code>&lt;location name="content" path="/content/" themeDir="content"&gt; &lt;url name="contentpart_stunt" path="stunt.aspx" pattern="stunt.aspx" vanity="{2}" physicalPath="##themeDir##" page="stunt.aspx" /&gt; &lt;/location&gt; </code></pre> <p><strong>SiteUrls.config</strong></p> <p>In the SiteUrls.config, under the section for root pages, <code>&lt;location name="common" path="/" themeDir="common" &gt;</code>, I added this entry:</p> <pre><code>&lt;url name="redirect_stunt" path="/" pattern="stunt.aspx" vanity="{2}" redirect="true" physicalPath="/content/" page="stunt.aspx" /&gt; </code></pre> <p><strong>Important pieces in this line</strong></p> <pre><code>redirect="true" physicalPath="/content/" </code></pre> <p>these lines tell it to redirect and where to.</p> <p><em>More Info:</em> <a href="http://docs.communityserver.com/customization/understanding-the-siteurls-config-file/" rel="nofollow">http://docs.communityserver.com/customization/understanding-the-siteurls-config-file/</a> </p>