The URL has been used and abused by those trying to do SEO for a long time; however, making your URLs contribute to your SEO efforts requires adherence to a few important rules. These rules will not only help you avoid any problems (i.e., creating spammy URLs), but also create optimized and user-friendly URLs that will contribute positively to SEO.
URL Structure (On-Page SEO)
Short URLs are better
The shorter the URL the more useful and helpful these will be user-friendly URLs. Keeping URLs conice will also help you avoid creating a spammy URL. For example, instead of using www.example.com/widget-category/red-widgets-los-angeles-ca.html it would be better to have www.example.com/widget/red-widgets.html.
Avoid using dynamic URLs
But if you must, try and keep them to one or two parameters. Use hyphens to separate words – Only use hyphens to separate words in URLs. Do not use underscores, spaces or any other character. This will not only help make the URL easily legible for users, but it will make it easier to decipher for search engine spiders. But do keep in mind to avoid long URLs with multiple hyphens, as it will make the URL seem/be spammy.
The fewer directories the better
Avoid creating a new directory in your URL if you can. This does not mean that every page should be in your root directory.
For example, instead of having www.example.com/category/widgets/color/red.html you can benefit by using www.example.com/widgets/red.html.
URLs should be descriptive
Try to keep URLs as descriptive as possible while maintaining brevity. For example, instead of using www.example.com/product-cateogry-5/product-id-1234.html, use www.example.com/widgets/red-wooden-widget.html.