14

I need help in figuring out what is the best URL structure for my website. On the website, I’ll have pages for users and business and would like to give each a custom profile URL. Here are the solutions that I came up with:

Solution 1:

User: example.com/johndoe
Business: acmecorporation.example.com

Solution 2:

User: example.com/johndoe
Business: example.com/uk/acmecorporation
*uk is the country of the business

Solution 3:

User: johndoe.example.com
Business: example.com/acmecorporation
  • There may be lots of users, but how many companies will there be? Just AcmeCorporation or zoos there be more than just the one? – JonW Mar 4 '15 at 9:06
  • 1
    There are going to be many companies 10,000+ – AlGallaf Mar 4 '15 at 9:08
  • 3
    How are you going to resolve duplicates? What are your goals? Why would I - as a user or a corporation - care about that URL? – peterchen Mar 4 '15 at 12:11
  • 4
    Keep in mind that users do not necessarily have unique names. You'll end up with URLs like dummy.com/johndoe and dummy.com/johndoe1 – glasspill Mar 4 '15 at 13:15
  • 2
    @AlGallaf we definitely want to help. It's just that I don't see a question in your post. Or what criteria you are using to judge which one to go with. Or what your user's needs are. Context is important. – DA01 Mar 5 '15 at 16:37
26

Since you want to indicate function in your URL:s, the best way would be to actually type out that function in the URL.

My suggestion:

User:     dummy.com/user/johndoe
Business: dummy.com/business/acmecorporation

Edit: adding an excellent point made by 10MAY in another answer in this thread, regarding why you shouldn't use sub-domains:

Also, sub-domains mainly are used to switch to different products being given out by the website/business owner of the primary domain.

  • 2
    I like this approach as it gives the user clear indiciation of the type of page they are looking at. For example there are businesses out there named after people (i.e. Ben Sherman) so there could be confusion when just reading the URL if there isn't an indication that it is a business and not a user. – JonW Mar 4 '15 at 9:38
  • What about having the urls as dummy.com/u/johndoe and dummy.com/b/acme ? – AlGallaf Mar 4 '15 at 18:46
  • 3
    @AlGallaf at a glance /b/ and /u/ doesn't mean much to the user versus actually spelling it out. The full words just make ti more obvious what you're looking at. – Howdy_McGee Mar 4 '15 at 21:51
  • @magnus.westrom How about how Facebook & Twitter handle their URLs? My websites is going to be social media like as it'll focusing on users and businesses. – AlGallaf Mar 5 '15 at 8:27
  • 1
    @AlGallaf I wouldn't say that having username directly added after the domain name is a social-media-design per se, I think that is a direct effect of them only having one type of sub-element, which is a user. Since you have two types, users and businesses, this should be pointed out clearly. Facebook and twitter don't have to be clear about that, since there can be no confusion about what twitter.com/magnus_westrom is – magnus.westrom Mar 5 '15 at 9:41
3

I would say it totally depends on what you are mainly targeting in the website. If the main purpose is more of social connection then the best way to go about would be to have

User: dummy.com/johndoe

Business: dummy.com/business/silversolutions

On the other hand if the website mainly focuses on getting business information to the people rather than the people. I'll say you should go in with

User: dummy.com/user/johndoe

Business: dummy.com/silversolutions

The subdomain system looks cool at first, but google ranking doesn't pick sites with too many sub-domains so I would suggest you avoid it, until the fact you want your site to actually provide the business owners a premium feel.

Also, sub-domains mainly are used to switch to different products being given out by the website/business owner of the primary domain.

That would be my suggestion

  • "Also, sub-domains mainly are used to switch to different products being given out by the website/business owner of the primary domain." is an excellent point. I'd really like to add this to my answer, not sure if this is against stack exchange etiquette or not. Would you mind? – magnus.westrom Mar 4 '15 at 9:31
  • 1
    no man.. its cool go ahead... would help in getting the best answer possible.. :) – Tanmay Saxena Mar 4 '15 at 9:32
  • 1
    One point of caution with this though - you probably don't want such custom links directly off the site root. Pages on the site root may be specific to the site (such as dummy.com/contact-us) so having user or company pages hanging off the root directly could cause confusion (or at worse, duplication with critical site pages). If your answer is the one that is chosen I would suggest having an additional level of hierarchy there (dummy.com/company/{name}) for situations where there will be many instances of a type. – JonW Mar 4 '15 at 9:36
  • yeah agree with JonW... then you will need to use the site root links as the sub-domain styled ways. like developer.apple.com – Tanmay Saxena Mar 4 '15 at 10:13
1

I would agree with @10MAY that subdomains are not appropriate here.

Your only solution without subdomains is this one:

User:     example.com/johndoe
Business: example.com/uk/acmecorporation
*uk is the country of the business

But why is the country all of a sudden that important (it wasn't for the other examples)?

If you want to go with the standard REST approach, your example should look like this (assuming that users and businesses are completely separate entities[*]):

User:     example.com/users/johndoe
Business: example.com/businesses/acmecorporation

It makes sense from a UX/Frontend perspective, as the user directly knows what they are dealing with (johndoe is a user, acmecorporation a business), and also from a Backend perspective (example.com/users/johndoe is the endpoint for getting/changing that user, example.com/users/ the endpoint to list all users or add new users).

[*] If they are not (for example, a user always belongs to a business), something like this might be more appropriate:

Business: example.com/businesses/acmecorporation
User:     example.com/businesses/acmecorporation/users/johndoe

  • There are going to be business from different countries. That's why I though of adding the country initial in the path. – AlGallaf Mar 4 '15 at 18:39
0

What if the user "owned" the business:

User:     dummy.com/johndoe
Business: dummy.com/johndoe/acmecorporation

This way the user can see the relation in the URL.

0

Please also include a version tag/identifier in the URL so that later, in the future the next time someone comes up with a bright idea of let's do things a new way, the (old) URL does not have to break. Your users will hate that.

User:     www.example.com/apiv1/users/johndoe
Business: www.example.com/apiv1/businesses/acmecorporation

You might want to use another phrase than apiv1, but do not skip having a part that fills this role.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.