Mono Support Removing /MonoX/Pages from the URL (Closed)

Viewed 41090 time(s), 17 post(s), 2/15/2012 2:44:49 AM - by sam0864
2/17/2012 5:09:17 PM
7207 Reputation 956 Total posts

Note that defaultPage and urlPattern should have a tilda character (~) at the beginning, but the URL cleaner on this board is removing it from the post.

1
2/15/2012 2:44:49 AM
656 Reputation 79 Total posts

Is it possible to remove /MonoX/Pages from the URL? I am not familiar with URL ReWrite syntax. What is the right syntax to remove /MonoX/Pages from the URL?
Is URL Rewrite enabled by default?
Thank you

2
2/15/2012 8:00:10 AM
15993 Reputation 2214 Total posts

Hi,

yes URL rewriter is enabled by default and for some pages you can change the rule and remove the MonoX/Pages. Can you please specify what URL you want to rewrite ?

Regards

3
2/15/2012 5:22:21 PM
656 Reputation 79 Total posts

Thank you for the quick response

For example, I would like to rewrite /MonoX/Pages/SocialNetworking/* to /SocialNetworking/*

4
2/16/2012 6:01:47 PM
7207 Reputation 956 Total posts

Something like this would work, note that you have to place it towards the beginning of the URL rewriter's list of rules. I replaced the "SocialNetworking" with SN to avoid possible recursion problems.

<rewrite url="^(.*)/SN/(.*)?$" to="$1/MonoX/Pages/SocialNetworking/$2" name="SN" urlPattern="/SN/{PageName}" />


5
2/17/2012 4:24:07 PM
656 Reputation 79 Total posts

One more question: After updating the web.config with new line for url rewrite, the internal pages links still use the long URL to link to each other. For example, the link to discussion tab is /MonoX/Pages/SocialNetworking/Discussion.aspx instead of /SN/Discussion.aspx and the same applies for topic, groups, photos

What is the best way to update the internal links to use the short URL?

6
2/17/2012 4:45:16 PM
7207 Reputation 956 Total posts

It depends what URLs you would like to change. That particular URL can be changed via Page admin panel in the backend admin section, you would have to generate a new "external" navigation item in the left side treeview and enter your URL there (this is how the Blog navigation is set in the default site). Other than that, you would have to adjust all URL rewriting rules to match your URL schema. Note that the "urlPattern" attribute in each rule is used by many Web parts to produce the URLs they require - parameters in curly braces are replaced with the actual values.

7
2/17/2012 4:55:38 PM
656 Reputation 79 Total posts

Yes, I tried that
but the problem is limited to that. For example, any topic link will go back and use the long url (i.e. /MonoX/Pages/SocialNetworking/Discussion/dtopic/...)
How can we change this link?

Is there a better way to change the URLs? Can we do it directly through SQL script for example?

8
2/17/2012 5:08:01 PM
7207 Reputation 956 Total posts

You would have to change the discussion board rewriting rules to achieve that. These links are not hardcoded in the database.
Discussion board, blogs, and other more complex parts have specific URL rewriting rules to allow them to be dropped on an arbitraty page without any changes to URL rwriting rules. They track the name of the page they are placed onto, and use it in the URL rewriting process. You can change these rules to follow this scenario:

<rewrite url="^(.*)/dboard/(.*)/(.*)/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Discussion.aspx?boardId=$2&$5" name="Discussion" defaultPage="/MonoX/Pages/SocialNetworking/Discussion.aspx" urlPattern="/dboard/{BoardId}/{Slug}/" />

9
4/9/2012 3:32:09 PM
659 Reputation 84 Total posts

Hello,

I've been thinking about using the Url Rewriter in order to remove or replace the /MonoX/ Tag from all the pages of the project, is there any regex that you could provide me with in order to achive that? or there is another way to do this?


Best Regards.

10
1 2
This is a demo site for MonoX. Please visit Mono Software for more info.