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 (Zatvorena) (Mono Support )

39723 put(a) pogledan, 17 odgovor(a) 15.2.2012. 2:44:49Kreirao(la) sam0864
denis

denis

17.2.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.
Ovaj sadržaj još nije ocijenjen. 
7207 Reputacija 956 Ukupno objava
sam0864

sam0864

15.2.2012. 2: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
Ovaj sadržaj još nije ocijenjen. 
656 Reputacija 79 Ukupno objava
khorvat

khorvat

15.2.2012. 8: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
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
sam0864

sam0864

15.2.2012. 17:22:21
Thank you for the quick response

For example, I would like to rewrite /MonoX/Pages/SocialNetworking/* to /SocialNetworking/*
Ovaj sadržaj još nije ocijenjen. 
656 Reputacija 79 Ukupno objava
denis

denis

16.2.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}" />


Ovaj sadržaj još nije ocijenjen. 
7207 Reputacija 956 Ukupno objava
sam0864

sam0864

17.2.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?
Ovaj sadržaj još nije ocijenjen. 
656 Reputacija 79 Ukupno objava
denis

denis

17.2.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.
Ovaj sadržaj još nije ocijenjen. 
7207 Reputacija 956 Ukupno objava
sam0864

sam0864

17.2.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?
Ovaj sadržaj još nije ocijenjen. 
656 Reputacija 79 Ukupno objava
denis

denis

17.2.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}/" />
Ovaj sadržaj još nije ocijenjen. 
7207 Reputacija 956 Ukupno objava
DavidGarcia

DavidGarcia

9.4.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.
Ovaj sadržaj još nije ocijenjen. 
659 Reputacija 84 Ukupno objava
1 2