Mobile app version of vmapp.org
Login or Join
Goswami781

: Should my users' profile page URL be /user/bob or just /bob? Currently, the URL to a user's page is this: website.com/user/bob But I'm considering changing this to be: website.com/bob Without

@Goswami781

Posted in: #Htaccess #Php #Redirects #Seo #Url

Currently, the URL to a user's page is this:

website.com/user/bob


But I'm considering changing this to be:

website.com/bob


Without the /user/ part. It comes across as much cleaner and easier to access, as user pages are one of the most frequently-visited pages on my site.

I have, however, a few questions:


Is this something I should do? Is it SEO friendly?
Would this be done within my code (my routes file) or would it be done through .htaccess or some other method?


Thanks.

10.06% popularity Vote Up Vote Down


Login to follow query

More posts by @Goswami781

4 Comments

Sorted by latest first Latest Oldest Best

 

@Ravi8258870

With the approach of website.com/bob you need to make sure that the user cannot select a username which is the name of a subpage (e.g. prevent a user from choosing the name "home" if there is a site website.com/home etc.)
This becomes especially important if you want to keep the option of adding new pages later.

As DPS pointed out, facebook has a nice way that doesn't include a prefix by appending first and last name with a . in between which avoids all collisions as long as you choose your pages' names without dots respectively.

10% popularity Vote Up Vote Down


 

@Kimberly868

Do the /user/bob style, as there's a very good reason why you should not use /bob.

Specifically, that means you can't have any other paths in your website, as they might collide with a user name. For example, someone could name themselves "images" and now your /images folder doesn't work. Or someone who's name is "John Smith" but wants to be user "js" now is colliding with your /js folder where you put JavaScript.

Yes certainly with routing configurations you could allow this, so that /images/foo.jpg works and gives you the image "foo.jpg" in the image directory, but then /images would get you the user named images. That would basically be really confusing from the technical design perspective.

I know this isn't going to happen often, but in general it's just bad path design to have a scheme that you know can fail in some cases.

If you don't like the unfriendly naming of /user, try something else like /home or anything else you can think of that might be a bit less utilitarian.

10% popularity Vote Up Vote Down


 

@Cugini213

The user/ part in the url acts as a namespace identifier, by separating user profiles from other accessible resources or entities. Say your app also has groups. Then an user Ana can be distinguished from a group Ana by the namespace identifiers e.g /user/ana and /group/ana.

If the word user needs to avoided for what ever reason, you can consider alternatives like profile/, gamer/, member/ etc.

Regarding SEO, keeping user/ in the url is beneficial since it adds one more keyword as well as increases the chance of having the url properly categorized by search engines.

10% popularity Vote Up Vote Down


 

@Jamie184

This sounds like a personal opinion type question, however, it does have a few potential design/development flaws.

I can't see as this would benefit SEO in any way - in fact, it could make it harder to associate this URL as a "user profile" since there is no parent path segment (subjective)? But it's difficult to imagine that a user profile page would be so important (SEO wise) for your site anyway?

Without knowing anything more about your site I would leave your URLs as /user/bob instead of simply /bob. Reducing the URL to simply /<username> could potentially create development issues (depending on how your site is implemented):


This could make the URLs harder to route (depends on how you are currently doing this). See note below.
What if a user called their username about, contact or login? Apart from being confusing for users, you would need to implement some kind of lengthy list of disallowed usernames in order to prevent these type of name clashes (prone to error). And this will naturally reduce the namespace of possible usernames. With /user/<username> everything is a username. Something like /user/about might still look confusing, but it won't break your site.



Would this be done within my code (my routes file) or would it be done through .htaccess or some other method?


Well, that depends on how your site is implemented. Certainly, if you change the URL from /user/<username> to /<username> then this is not something you could do in .htaccess. Since, in .htaccess there is no way to determine whether /<something> maps to a user profile or some other site page, like /about, /contact or /login etc.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme