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.

vanity urls  (Mono Support )

Viewed 28089 time(s), 7 post(s) 17.05.2011 22:16:07by ldc0618
ldc0618

ldc0618

17.05.2011 22:16:07
Is it possible to configure vanity urls for groups and users

for example:
http://localhost:8083/MonoX/Pages/SocialNetworking/Groups/GroupView/ogTE0Fmv1E6yrZ2lAYWbkg/Web-design/

would become:
http://localhost:8083/Web-design/

Thanks
Dieser Inhalt wurde noch nicht bewertet. 
20 Reputation 5 Total posts
khorvat

khorvat

18.05.2011 07:30:32
Hi,

you may notice that (http://localhost:8083/MonoX/Pages/SocialNetworking/Groups/GroupView/ogTE0Fmv1E6yrZ2lAYWbkg/Web-design/) this is already a rewritten URL but if you want to make this even shorter you can do this by using the standard MonoX rewriting mechanism.  You can find more information related to MonoX URL rewriting in MonoX manual under the "2.5.1.1 URL rewriting". Here is a sample how this would look like:

<rewrite url="^(.*)/Web-design/(\?(.+))?$" to="$1/MonoX/Pages/SocialNetworking/Groups/GroupView/ogTE0Fmv1E6yrZ2lAYWbkg/Web-design/$2" name="WebDesign" defaultPage="/MonoX/Pages/SocialNetworking/Groups/GroupView/ogTE0Fmv1E6yrZ2lAYWbkg/Web-design/" urlPattern="/MonoX/Pages/SocialNetworking/Groups/GroupView/ogTE0Fmv1E6yrZ2lAYWbkg/Web-design/" />

Note: You need to add the above rewriting rule to the web.config

Regards
Dieser Inhalt wurde noch nicht bewertet. 
15993 Reputation 2214 Total posts
ldc0618

ldc0618

18.05.2011 13:43:38
Thanks but what if i have ten of thousands of groups? I am considering migrating an existing community site to monox and this is a critical consideration for me. Is there a more generic rule or another approach?
Dieser Inhalt wurde noch nicht bewertet. 
20 Reputation 5 Total posts
denis

denis

18.05.2011 20:03:25
A more universal approach would require the presence of the groups' unique ID (a shortened Guid, like "ogTE0Fmv1E6yrZ2lAYWbkg" in the example above). MonoX by default does not require users to use unique group names when opening a group.
You can change this behaviour by changing the group-related URL rewriting rules, enforcing the name uniqueness in the group creation part (GroupEdit.ascx), and manually setting the GroupId property in the group view part (GroupView.ascx). This task requires a bit of coding, I we can send a code skeleton if you are interested.
Dieser Inhalt wurde noch nicht bewertet. 
7207 Reputation 956 Total posts
ldc0618

ldc0618

18.05.2011 20:10:34
That would be great if you could send as I am just getting started
Dieser Inhalt wurde noch nicht bewertet. 
20 Reputation 5 Total posts
denis

denis

20.05.2011 22:40:56
OK, I am preparing a small example that uses a simpler approach - using the custom URL rewriter transform method. It allows users to enter arbitrary URL formats that are transformed on the fly to the required set of parameters. In your case, group name will be transformed to the group id that is needed by all group modules, although that ID will not be visible in the URL.
Note that it is still recommended to have one additional level in your URL to identify the rewriting section. For example, instead of http://localhost:8083/Web-design/ you will need (in almost real world scenarios) to have http://localhost:8083/Group/Web-design/ . "Group" can be any string of your choice, but without it, basically every resource will be mapped to group section.



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

denis

23.05.2011 20:07:58
As promised, I have put together a small blog post with a code sample that can be used in such scenarios: http://www.mono-software.com/Blog/post/Mono/110/Customizing-ASP-NET-URL-rewriting-rules/
Dieser Inhalt wurde noch nicht bewertet. 
7207 Reputation 956 Total posts