Regarding Google’s Search Engine Optimization Starter Guide, chapter 2, Improving Site Structure, a well structured site URLs will help Google crawl the whole site document better. With a readable and meaningful words URL, it helps our visitors to remember the link easily, but also provides search engines more information about the page. Furthermore, in Google’s search result, the URL will also be displayed below the title and description. Therefore, I guess a user-friendly URLs will be one important factor to affect the SEO (search engine optimization).
3 Best Ways to Optimize Site URL
According to Google official suggestion, site structure is one important element to improve the search result. Creating a simple, understandable, readable, and meaningful URL can efficiently help the website to be explored to readers. Following are 3 best practices for you to optimize your website URL structure.
Make Your URL Readable
What kind of URL can be considered as readable? There is no world wide standard. But as Google’s advice, using words in the URL can help visitors to read it. So when we choose words to build up our URL, it’s better to make the URL relevant to the page content. The following URL example could be a good one: “…/seo/improving-site-structire/”.
When building URL, here are 3 cases we must avoid:
- Make the URLs too long to read
- Using meaningless word such as a.html, b.html
- Repeating the keywords in URL, such as seo-example-seo-example.html
Using Simple Category Structure
Simply the website directory structure and well organize the website content by categories. When doing so, please note:
- Make the structure necessary simple. Please avoid deep structure, such as “…/mobile/android/google/tablet/nexus.html”
- Make categories relevant to content. For example, “…/android/nexus7.html”
Avoid Repeated Content with Different URL
This could highly happen when we restructure old age website. Sometimes, we could assign a page in two different categories by mistake. For example: “…/android/nexus7.html” vs “…/google/nexus7.html”. If you really need to do so, it’s better to use 301 permanent redirect the less important URL to the preferred URL.
Optimize Permalink URL in WordPress
In above section, I explain the concept about how to optimize the URL. All above ideas is according to the Google’s official SEO guide, I just read it and make it more readable for beginners like me. There is still a big gap between understanding the concept and implementing the guidelines in real website.
I believe lots of people setup their website with WordPress now. Just like me, people don’t like to reinvent the wheel again and again. WordPress is the most popular framework to help setup the website in a minute. However, because of some historical reason, WordPress doesn’t follow the Google’s guideline to generate the post URL for us. That’s why WordPress provide us a way to set the Permalinks format. Here are some tips about how to optimize the URL in WordPress by setting permalinks.
Remove Category Base from WordPress Permalink
There are lots of solutions to guide us how to remove “category” from permalink. For example, lots of people says we can set “.” (dot) in category base to avoid the keyword “category” appearing in every category link. By default, WordPress will show a category URL as following format:
https://jmsliu.com/category/android https://jmsliu.com/category/ios
To remove the category from the link, we set the “category base” as “.”
But if you do so, the category url in the sitemap xml will look like:
https://jmsliu.com/./android
Obviously, this method doesn’t work well, though it remove the category base.
After searching for several hours, the best way is using WordPress plugin. I am using “No Category Base” plugin. It successfully removes the category from permalink without any side effect.
Set Your Post URL Meaningful and Readable
In WordPress, it provides several post format we can use, and we are able to customize the format as well.
The best practice to set the post format is changing the permalink format from:
/%post_id%/%postname%.html
to
/%category%/%postname%.html
Make Your Category As Directory
Hope the subtitle doesn’t make you confused. Make category as a directory, just add a trailing slash at the end of category url. For example:
https://jmsliu.com/android/
By default, WordPress doesn’t add trailing slash at the end of category or tag url. We can use some plugin as “Permalink Trailing Slash Fixer” to help us. However, this plugin doesn’t add slash in sitemap, and it also adds slash behind page url, which I don’t really like.
Make Post Permalink Short and Structure
After above changes, the website URL looks better now. The URL is readable and meaningful. But because some of the posts are assigned in a second level category. The URL looks very long. For example:
https://jmsliu.com/blog/android/android-tablet/amazon-kindle-fire-reviews.html
The URL structure looks very long and there are some repeated keywords like “android”, “android-tablet”. As the “android-tablet” is the sub-category of “android”, WordPress will show the whole category hierarchy in the URL. To only show the last level category in the URL, I am using another WordPress plugin “Single Category Permalink”, which can perfectly trim the parent category name from the URL, without any side effect.
Category and Tags
Both category and tag are ways of taxonomy. When using them smartly, it can tell Google your website well structured. On the other hand, if we use them to much, it could make our site worse than having. For example, if we using both “android” in category and tag. The WordPress will create different URL for them, highly could be “android” and “android-2”, which will break our URL structure. Furthermore, Google will find the same content under “android” and “android-2” directory.
The best practice (not verified) is using only one taxonomy system, category or tag. Don’t use them both. If you really want to use it, I would make the tag page as “indexed” but “no-follow”.
Provide Simple Sitemap
After modifying all permalinks format for post URL, category URL, and tag URL. Please remember to update all changes in the website sitemap. There are lots of SEO plugins will help to do so, such as All In One SEO Pack or Yoast SEO.
Using 301 Redirect for Old Broken Link
Last but most importantly, once you change the whole website link format, when visitors come to the website from old link reference, or Google bot crawls from old link, they will face the 404 page not found error. For old age website, it may have lots of reference from other websites by putting a link there. After change the website link format, all the old links will lead to 404 page not found error, which will cause the old site losing all traffic referring from other sites. To be honest, the content is still there but with a different link. To solve the problem, it’s better to use 301 permanent redirection to direct the old links to new links.
How to Set 301 Permanent Redirection in WordPress
If your website is new or has very few content, it’s not that difficult to set 301 permanent for those page after you restructure your website URL. You can set your 301 permanent redirection by plugin or just write the URL rewrite rules in .htaccess file. Here is an example about how to add a redirection in .htaccess file.
In the example, I will redirect my old page:
https://jmsliu.com/2804/android-mobile-app-template-for-website.html
to a new page:
https://jmsliu.com/android/android-mobile-app-template-for-website.html
Then, the URL rewrite rule shall be like this:
RewriteRule ^/?2804/([-a-z\.]+)$ android/$1 [R=301,L]
Please don’t forget to redirect your old category URL to new category URL. Here, I will redirect
https://jmsliu.com/category/android
to
https://jmsliu.com/android/
The URL rewrite rule in .htaccess will be:
RewriteRule ^/?category/([-a-z\.]+)$ $1/ [R=301,L]
So, if you have 100+ of posts in your website, you have to add 100+ rules in .htaccess file, one by one. That could be a terrible problem. If you know how to write WordPress plugin, it could be much easier. For my website, I already has 200+ articles under 8 categories. Writing the 301 permanent redirection rule one by one is impossible. I will start to write a plugin which can help me generate URL rewrite rules automatically.