What’s the Best URL Structure for SEO?

What’s the Best URL Structure for SEO?

24.Nov.2021

Before we get into the details of URLs, let's go over a few basic principles:

First and foremost: make sure to not mislead your visitors with your URLs. The last thing you want is for someone to click on a link and end up at an unexpected page. For example, if you're having trouble with customer service, then /support or /contact will be more helpful than /tickets .

More important than making your site search engine friendly (more about that later) is making it user-friendly (and even human-friendly). First off, don’t include file extensions in the path—this makes it hard for people who are used to just typing in domain names without file extensions. Also, don’t include leading slashes ( / ) in the path, regardless of the OS—for example, http://www.tutsplus.com is much easier to type than http://www.tutsplus.com/ .

Secondly, keep your URLs short and sweet for easy typing. You don't want people mis-typing your URLs all the time. For instance, you probably wouldn’t want to have a long URL like this: http://www.tutsplus.com/articles/news/deface-a-section-of-your-website-withnginx/. Stick with just letters and numbers if possible—that way you can even use it as part of your email address when posting comments on other sites.

Finally, try to make your URLs as readable as possible. This is especially important for content-heavy sites where people will be typing in a lot of URLs—for example, if someone sends you a link to the page I’ve written about using WordPress tags , it would be nice if you could quickly tell what the post was about just from the URL: http://www.tutsplus.com/tutorials/wordpress/use-tags . Even though that extra info isn't technically part of the URL itself, it's still something that can affect your search engine rankings and how people perceive your site. That's why it makes sense to give every page its own unique title (which I'll get into next).

With those guidelines in mind, let’s move onto the most important question: what do we put into our URLs?

The first thing you need to figure out is how many levels of hierarchy your site has. For example, here on Tuts+ we have two main sections—articles and videos . Each one of these sections has several sub-categories (such as WordPress , design , photography , etc.) while each category has its own set of pages. This means that there are three levels of hierarchy for articles : home , articles , and tutorials . Notice that we can use the homepage as a link to each level of pages on the site.

For SEO purposes, you don’t want to go any lower than three levels. Google and most other search engines won't be able to properly index pages that deep, which means it’s a good idea to have your main sections at the top level. To get this to work, you need to rely on the Title element in the <head> of each page—more on that in a bit.

What about URLs for single pages? Let’s say we wanted to add an About Us page under articles .

Now, whenever we link to this page from elsewhere on the site (or if someone types in the URL), it's clear what's being discussed since it includes the main section of our site. By having a unique URL for each page of your website, you can help search engines better determine what that page is about. Once you have your hierarchy set up, it’s time to start writing the URL for each page of your site.

First off, let's get rid of the file extension—call it .html or .php , but not .html.php , since people tend to associate the HTML extension with the browser. Once you get rid of it, you'll probably notice that something looks a little off. Even if you removed the .html extension, all your URLs will still be http://www.tutsplus.com/articles/home/about-us.html , which means that you'll have to add some type of directory structure after the domain name.