Search code examples
urlroutesinfo

Route url which is recommended to use underscore or dash?


I'm getting a little confused about choosing the more right URL i would appreciate if you could recommend which one is better

domain.com/admin/manage_vehicles

or

domain.com/admin/manage-vehicles

or

domain.com/admin/manage/vehicles

Solution

  • The 3rd way is the most user friendly way to make a URL.
    It will be more useful when you have multiple routes of that same category.

    domain.com/admin/manage/vehicles
    domain.com/admin/manage/drivers
    domain.com/admin/manage/passengers
    

    But as an alternative, you can use the the 2nd way too.

    domain.com/admin/manage-vehicles
    domain.com/admin/manage-drivers
    domain.com/admin/manage-passengers
    
    • Hyphens are recommended by Google over underscores (source).
    • Hyphens are more familiar to the end user.

    And last of all, underscores and keyword joins are not recommended in URLs.

    domain.com/admin/manage_vehicles
    domain.com/admin/manageVehicles