Renaming Pages and Changing Page Urls

When you create a new page in mojoPortal content management system, it will suggest an url for your page based on the name you enter. You don't have to use the suggested url, you could change it before saving the page, but generally it does a good job.

However, if you rename an existing page there are a couple of things you should understand. By default, mojoPortal CMS will suggest a new url based on the new page name. You could change it back before saving if you wanted to keep the current url and only change the name, but you would have to pay attention to what it was, because as soon as you tab out of the name field it will suggest a new url based on the new name. Now assuming that you agree and want to let it change the url, then when you save what will happen is that it will create the new friendly url mapping and delete the old friendly url mapping. But then there is something else notable that mojoPortal will do for you. Because your old url might have been indexed by google or other search engines and you don't want the users who click the links to the old url in the search results to get a page not found error, mojoPortal creates a 301 Permanent Redirect from the old url to the new one. This way users who click those links in the google search results will land at the correct page and when google crawls your old url they will see that the url has changed permanently and they will index the new url instead of the old one. So this helps your SEO (Search Engine Optimization).

Of course it is even better if your page urls don't change. While a 301 redirect does help when you do change urls, it is a web axiom that cool urls don't change, and it is better for SEO as well in general to avoid the need for 301 redirects but do use them when you need to.

You can manage the friendly url mappings from Administration > Advanced Tools > Url Manager, but keep in mind if you were to edit them there, the friendly url must also match what you see in Page Settings so if you change it it needs to be changed there too. Best in general to let mojoPortal keep those in sync, but if something goes wrong that is where to look for clues.

You can also manage the 301 Redirects from Administration > Advanced Tools > 301 Redirect Manager As I'll discuss below, renaming a page and then renaming it back can cause unwanted 301 redirects, so you can look for them in the 301 Redirect Manager and delete them if needed.

With the above background information in mind, some of you might prefer that mojoPortal would not automatically suggest a new url when you make a change to the page name of existing pages. You can disable that behavior by adding this to your user.config file:

<add key="AutoSuggestFriendlyUrlsOnPageNameChanges" value="false" />

One reason that some people prefer to disable this is because they've run into issues when they rename a page and then rename it back to what it was. Here is what happens.

1. You start with a page named My Article About Foo, and mojoPortal suggests an url like

2. Then you change the name to My Article About Celestial Foo.
With the default setting, mojoPortal will suggest a new url

Now if you think about it that might be a better url, the specificity may help your search rank if someone is searching for celestial foo than just having the less specific previous url. I'll leave the debates about it to the SEO folks, but my point is that it is not always a bad thing to change the url if the page is fairly new and you like the SEO of the new url better than the old one but in other cases you might prefer to not change the url. We leave it up to you to decide whether to disable it or not.

So behind the scenes mojoPortal created the new friendly url mapping, deleted the old one, and created the 301 redirect from the old url to the new one.

3. Ok, but now you changed your mind and decided to rename the page back. So the page is saved with the old url again, and the url is changed in Page Settings but it doesn't create a friendly url for the original url because it detects that that url is being redirected permanently. mojoPortal can't create another 301 Redirect because there is already a 301 redirect that redirects the now active page url (the restored original url) to the previous url (the url we changed to the first time) and if we now added one from the previous url to the now active url it would cause an infinite redirect loop with both urls redirecting to each other.

So mojoPortal is smart enough to not do that but it isn't smart enough to solve the fact that now that active url is still 301 redirect to the previous url which is no longer valid so it results in a page not found error. To fix this you would need to go into Administration > Advanced Tools > 301 Redirect Manager and delete the unwanted redirect. And you need to go back into Page Settings and save again to re-create the friendly url for the original restored url. And then double check if anything else unwanted is was created in the 301 Redirect Manager.

See also

Created by Joe Audette on Jul 08, 2011
Last Modified by Joe Audette on Jun 23, 2012