MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

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

Viewed 37905 time(s), 17 post(s) 2/15/2012 2:44:49 AMby sam0864
denis

denis

2/17/2012 5:09:17 PM
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.
This content has not been rated yet. 
7207 Reputation 956 Total posts
sam0864

sam0864

2/15/2012 2:44:49 AM
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
This content has not been rated yet. 
656 Reputation 79 Total posts
khorvat

khorvat

2/15/2012 8:00:10 AM
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
This content has not been rated yet. 
15993 Reputation 2214 Total posts
sam0864

sam0864

2/15/2012 5:22:21 PM
Thank you for the quick response

For example, I would like to rewrite /MonoX/Pages/SocialNetworking/* to /SocialNetworking/*
This content has not been rated yet. 
656 Reputation 79 Total posts
denis

denis

2/16/2012 6:01:47 PM
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}" />


This content has not been rated yet. 
7207 Reputation 956 Total posts
sam0864

sam0864

2/17/2012 4:24:07 PM
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?
This content has not been rated yet. 
656 Reputation 79 Total posts
denis

denis

2/17/2012 4:45:16 PM
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.
This content has not been rated yet. 
7207 Reputation 956 Total posts
sam0864

sam0864

2/17/2012 4:55:38 PM
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?
This content has not been rated yet. 
656 Reputation 79 Total posts
denis

denis

2/17/2012 5:08:01 PM
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}/" />
This content has not been rated yet. 
7207 Reputation 956 Total posts
DavidGarcia

DavidGarcia

4/9/2012 3:32:09 PM
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.
This content has not been rated yet. 
659 Reputation 84 Total posts
1 2