What is better for a rails site? / {login} or / user / {login}

Which is better (for the user, for longevity, for performance, for whatever):

http: // {site} / {login}, for example. http://wildobs.com/adam_jack

or

Http: // {site} / user / {Login}

Pros of the first:

  • The user feels more special.
  • URLs are shorter.

Against the previous:

  • It is not possible for users with logins to match keywords, and keywords are likely to grow over time.

Clearly, this is important in order to be eligible (or to make mistakes and adhere), as all users define URLs based on this. Changing it would seem to be suicide on the site.

Do pros (especially over time) outweigh the pros?

+6
design url namespaces ruby-on-rails friendly-url
source share
5 answers

I would say that the cons outweigh the pros, so go with / user / login over / login. Consider stackoverflow, since it is MVC: I think it’s easier to program, knowing that everything in / user / blah will always refer to the user, whereas if you do not, you will have to consider every possibility.

For example, in the site / foo file, foo could be a username, admin, or another keyword. This is much easier to handle if you properly segment everything so that you know if you see that the site / user / foo is always a user named foo.

+7
source share

You can consider the third option:

Limiting users to a single character instead of a directory, as in unix.

http: // site / ~ username

This can even lead to modrewrite to / user / username, if more convenient.

Then you have short names that are easy to handle, and none of your regular pages will use this special character.

-Adam

+6
source share

There is a very important issue that allows users to create arbitrary names on the root web server (as possible by choosing their own login if you use / {login} instead of / user / {login}): some names have special magic values, and these values ​​are determined by third parties. For example:

  • robots.txt , also known as the "Robot Exclusion Standard," followed by all well-managed search engines.
  • favicon.ico , which ran as an Internet Explorer standard and was later adopted by several other browsers.
  • Some websites (at least Google and IIRC Yahoo) use the fact that you can create a specially named file in the root web server as proof that you are the webmaster of the site and thus gain access to some additional features (e.g. Google Webmaster Tools).

There are several others; I heard about Sitemaps and files that allow additional cross-domain access, but I don't know (or anyone else) all of them.

+2
source share

Personally, I would go for / user / {login}

Using / {login} is too much like cluttering the global namespace, and we all know that global variables are bad;)

0
source share

From RESTful MVC, the last time I checked the example from the Restful Authentication plugin is the session creation template. Therefore, instead of logging in, the user creates a session for the user. In this case, GET http://{site}/session/new will display the login screen and POST http://{site}/session with the correct parameters that will register the user if authentication is successful.

Then, if you want, you can create a new route for http://{site}/login , which will be redirected to http://{site}/session/new . Similarly, DELETE http://{site}/session will DELETE http://{site}/session out.

0
source share

All Articles