A URL (uniform resource locator), also known as web address, is a reference to a resource such as a webpage. For example, the URL to this showing webpage is the following:
Clean and structured URLs help both users and search engines to understand the web page. The following are some best practices on building good URLs.
Descriptive and Clean URLs
Create simple-to-understand URLs that can convey content information. Build URLs using keywords, brand names, titles or descriptions, and yet keep it short. URLs will be displayed in search results, and relevant words will be highlighted. This helps the user to quickly recognize the relevancy of the web page.
- Use descriptive words (such as keywords, page titles) relevant to the content
- Avoid numerical IDs or query parameters
- Use lower-case letters, and avoid symbols
- Use hyphen (-) to join words
- Create a simple directory structure (2-3 levels at most)
- Use relevant directory names
The following are some bad examples of URLs:
- http://example.com/post.php?id=12345&title=Abcd (non-understandable ID and parameters)
- http://example.com/dir1/article.html (meaningless directory and webpage name)
- http://example.com/dir1/dir2/dir3/article/page.html (too many levels of directories)
Provide one single URL for each document. Using multiple URLs for a document would split its reputation in search engine. Set up 301 redirects from non-preferred URLs to the dominant URL.
A page may need parameters in the URL to present the same content in different format; for example, sorting the products either by name or by price. Then we can add a
rel="canonical" link in the head of each HTML page. This lets the search engine treat all pages with the same canonical link as one page.
<link rel="canonical" href="http://theoryapp.com/"/>