301 Redirect Manager

When you create pages in mojoPortal content management system, the page gets a friendly url based on its title, like /fun-stuff.aspx would be the url for a page named Fun Stuff. Now if you change the name of the page later it will get a different url, so for example if I change the name to Really Fun Stuff, its going to get a new url /really-fun-stuff.aspx.

Now from an SEO (Search Engine Optimisation) point of view, its not a good idea to be changing your urls willy nilly. If someone bookmarked your old url you don't want it to be broken, or if its already popular in search results, you don't want it to be a broken link. So ideally, you need to have the old page do a 301 redirect to the new page. The 301 status code tells the browser that the page moved permanently. Now mojoPortal will create the 301 redirect for you automatically when you re-name a page or blog post. However, its still not a great idea to be renaming your pages frequently, you should avoid it generally but if you need to its ok to do it. You can also see the 301 redirect mappings and manually manage them from Administration Menu > Advanced Tools > 301 Redirect Manager. You need to be very careful with this feature, you do not want to create circular redirects where 2 urls redirect to each other.

Caching of 301 Redirects

Newer web browsers cache 301 redirects and this can be a problem if you make a mistake or change your mind about an url that has been redirected using a 301 redirect. You can clear the cache of your own web browser (though sometimes browsers can be very stubborn and not clear the 301s from the cache when you clear other things from cache) but you cannot clear the cache of the web browsers for your site visitors, so it is best to be very careful about changing page names and urls. In recent versions of mojoPortal we have also added some configuration settings that can be used to control how 301 redirects are cached by web browsers. You can put these settings in user.config and override them:

<add key="DisableCacheFor301Redirects" value="false" />
<add key="SetExplicitCacheFor301Redirects" value="true" />
<add key="CacheDurationInDaysFor301Redirects" value="5" />

Keep in mind that it is generally a good thing for browsers to cache 301 redirects for best performance. While you could disable the caching it probably isn't the best idea. A middle of the road approach is to just use a short cache duration like 5 days.

Re-Directing Urls that are not part of mojoPortal

Often people decide to use mojoPortal CMS after using something else for their web site, maybe they had a site comprised of static html page or using something other than ASP.NET such as PHP or Java etc. If you already have good search engine placement and page rank going on with your previous urls it is desirable to not lose that so it would be an ideal situation to be able to use a 301 redirect from the old url to the new url in mojoPortal so that search bots know that the url has changed permanently. This can help a lot for keeping your SEO while transitioning to mojoPortal.

By default, ASP.NET handles requests for files with a .aspx extension so the IIS web server will always hand the request over to mojoPortal, but for static files such as .html files, IIS will by default handle the request directly and not pass it to ASP.NET and therefore mojoPortal code has not opportunity to handle the request and do the 301 redirect. So you need to be able to configure things such that ASP.NET will handle the requests for .html files (and other files that you want to redirect such as .php .jsp or whatever extensions your previous pages used). This can be done by IIS configuration to map the handling for those file extensions to ASP.NET. In newer 7.x versions of IIS running in integrated pipeline mode, you can easily make ASP.NET the handler for all static files by following the same instructions for using extensionless urls. This question has also been discussed on this thread in the forums which may provide some additional information that is useful to you.

If you need to redirect static files like .html files you'll also need to add this in your user.config file:

<add key="UseUrlReWritingForStaticFiles" value="true" />

In all cases, you should test to make sure the re-direct is happening after configuring them.

See Also:

Created by Joe Audette on Nov 05, 2009
Last Modified by Joe Audette on Aug 21, 2012

Monetize Your Site With Site Membership Pro!