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 39538 time(s), 17 post(s) 15.02.2012 02:44:49by sam0864
denis

denis

17.02.2012 17:09:17
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.
Dieser Inhalt wurde noch nicht bewertet. 
7207 Reputation 956 Total posts
sam0864

sam0864

15.02.2012 02:44:49
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
Dieser Inhalt wurde noch nicht bewertet. 
656 Reputation 79 Total posts
khorvat

khorvat

15.02.2012 08:00:10
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
Dieser Inhalt wurde noch nicht bewertet. 
15993 Reputation 2214 Total posts
sam0864

sam0864

15.02.2012 17:22:21
Thank you for the quick response

For example, I would like to rewrite /MonoX/Pages/SocialNetworking/* to /SocialNetworking/*
Dieser Inhalt wurde noch nicht bewertet. 
656 Reputation 79 Total posts
denis

denis

16.02.2012 18:01:47
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}" />


Dieser Inhalt wurde noch nicht bewertet. 
7207 Reputation 956 Total posts
sam0864

sam0864

17.02.2012 16:24:07
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?
Dieser Inhalt wurde noch nicht bewertet. 
656 Reputation 79 Total posts
denis

denis

17.02.2012 16:45:16
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.
Dieser Inhalt wurde noch nicht bewertet. 
7207 Reputation 956 Total posts
sam0864

sam0864

17.02.2012 16:55:38
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?
Dieser Inhalt wurde noch nicht bewertet. 
656 Reputation 79 Total posts
denis

denis

17.02.2012 17:08:01
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}/" />
Dieser Inhalt wurde noch nicht bewertet. 
7207 Reputation 956 Total posts
DavidGarcia

DavidGarcia

09.04.2012 15:32:09
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.
Dieser Inhalt wurde noch nicht bewertet. 
659 Reputation 84 Total posts
1 2