From an SEO perspective there are two types of URLs: static URLs and dynamic URLs.
And a lot has been said about their importance for SEO. But some people still get confused by these terms and don’t really understand why static and dynamic URLs are treated in a different way.
This article represents a general overview of the main differences, advantages and disadvantages of static and dynamic URLs
What are static and dynamic Web pages?
Before speaking about the two types of URLs, let’s first clarify what are static and dynamic web pages.
A web page can be either static or dynamic.
A static web page is a page that contains contains HTML code, which entirely defines the structure and content of the page. The static pages is stored on a server and each time when a users makes a request by entering its URL, the server will load the exact same page with the exact same prebuilt content.
The user may interact with the page through clicking available links, but the static page will never be able to return information that is not pre-formatted.
Therefore, all updates and changes to a static page need to be hard-coded into the HTML code of the page – a very difficult and time consuming task, especially on big websites with thousands of pages. For that reason many website owners prefer to build dynamic websites and have dynamic webpages.
On the other hand, a dynamic web page is a page that contains a “server-side” code.
When a user makes a request, the server generates unique content each time the page is loaded.
Very often, dynamic pages use server-side code to access database information.
In this case the content of the website is stored in the database and the page’s content that is displayed is generated from information stored in the database: the user requests data (contained in a database) and in response the server will assemble on the fly the data and generate the page content, according to what is requested. The site serves basically as a template for the content
Normally, you should be able to tell if a page is static or dynamic by looking at its file extension in the URL. If it is “.htm” or “.html,” the page is probably static. If the extension is “.php,” “.asp,” or “.jsp,” the page is most likely dynamic.
What are static and dynamic URLs?
Therefore, we identify two types of URLs: dynamic and static.
Normally, you should be able to tell if a page is static or dynamic by looking at its file extension in the URL.
A static URL is a page address of a static web page – a page that has the same hard-coded content each time it is loaded.
A static URL never changes and does not contain any url parameters.
Normally, if finishes with the extension “htm” or “.html”.
Some typical examples of static URLs are:
- About us page – http://www.example.com/about-us.hml
- Contact page – http://www.example.com/contact.hml
As you can see, static URLs are pretty simple and do not contain variable strings.
A dynamic URL is a page address of a dynamic web page – a web page that results from the search of a database-driven web site.
Normally dynamic URLs have “.php,” “.asp,” or “.jsp,” file extensions and they contain variable strings (e.g.: ? & =).
Some examples of a dynamic URL:
- Forum Tread: http://www.example.com/forums/thread.php?threadid=12345&sort=date
You can spot dynamic URLs by looking for characters like: ? = &.
The URL portion after “?” is called the page’s query string parameter(s), or simply query parameter(s).
It represents a database row identifier which is used to retrieved the specified data from a database table.
Every time when URL parameter(s) changes, the resulted page will be different.
This means that the following dynamic URLs point to two different pages (because they have different page’s query string parameter) :
- Forum Tread 1 : http://www.example.com/forums/thread.php?threadid=12345&sort=date
- Forum Tread 2 : http://www.example.com/forums/thread.php?threadid=67890&sort=date
Dynamic URLs can contain multiple url parameters and more than one “?” character.
Which one is better for SEO: static or dynamic URLs?
Even if Google says that they can effectively recognize, crawl and index dynamic URLs, most SEO experts strongly advise to avoid using them.
The reason is that dynamic URLs have multiple disadvantages, related to their crawlability, indexability and usability.
Crawlability/Indexability disadvantages of dynamic URLs:
- Google can crawl dynamic URLs and interpret the different parameters, however they advise to remove unnecessary parameters and to keep dynamic URLs as short as possible
Google’s Webmaster Guidelines explicitly says:
If you decide to use dynamic pages (i.e. the URL contains a “?” character), be aware that not every search engine spider crawls dynamic pages as well as static pages. It helps to keep the parameters short and the number of them small.Google Webmaster Guidelines
- Yahoo confirms that they prefer static (or static looking) URLs
Yahoo! does index dynamic pages, but for page discovery, our crawler mostly follows static links. We recommend you avoid using dynamically generated links except in directories that are not intended to be crawled/indexed (e.g., those should have a /robots.txt exclusion).Yahoo! help
- Most search engines still have difficulties to index dynamic URLs containing more than one “?” character.
- Different dynamic URLs can have the same content
Another disadvantage of the dynamic URLs is that different URLs can have the same content.
So different users might link to URLs with different parameters which have the same content.
If User A wants to link to a specific page of your website, he will use the URL he sees in his browser. At the same time, User B who also wants to link to that same page, may see a different URL (with different parameters), no matter that the page is the same.
Usability disadvantages of dynamic URLs:
- Too long, difficult to remember and complicated to type manually
Dynamic URLs are almost impossible to remember by the visitors. They’re tod difficult to type and even when copying/pasting, there’s a possibility of cutting off the end of the URL, because it’s too long. Dynamic URLs are also too difficult to read out on a small screen (smartphone).
- Lower click-through rate in the search results, in emails, on web pages
Dynamic URLs are difficult ot understand and may look spammy to some website users. In result they get lower click-through rates compared to static URLs.
- Lower keyword relevance and no information about pages content
In dynamic pages generally don’t contain keywords. The URLs are automatically generated and webmasters are deprived of the possibility to create keyword rich URLs.
In addition, the user can’t have an accurate expectation of what he will see prior to reaching the page.
How to convert your dynamic URLs to static: Rewrite your URLs
Obviously the many disadvantages of dynamic URLs could be avoided, if you use static URLs. But can you use static URLs on a dynamic website?
The answer is YES, you can – but you’ll need to do some extra work called URL rewriting.
Whether you can implement URL rewriting on a website depends on the software your Web server is running:
- Apache, comes with its own built-in URL rewriting module – Apache Mod Rewrite Rule.
- IIS (Microsoft’s server software), doesn’t include URL rewriting capability by default, but you can purchase an add-on that can provide this functionality. ISAPI_Rewrite (about $100 US) is the most popular one.
By using URL rewriting module you’re able to create URL rewriting rules that inconspicuously redirect one URL to another, without the user’s (or a search engine’s) knowledge.The URL rewriting rules are included in the .htaccess file in your website’s document root.
When a request comes to the server for the new static URL, the URL rewriting module redirects the URL internally to the old, dynamic URL, while still looking like the new static URL.
The web server compares the URL requested by the user with the search pattern in the individual rules.
Let’s say you have the following dynamic URL:
and you want to transform it into a static looking URL:
By specifying URL rewriting rules, you are able to tell the server to internally redirect all requests for the URL “what-is-url-rewriting” to “/thread.php?threadid=12345”
In that way the URL is more memorable and your website can take advantage of all usability benefits of “static” URLs
How to write SEO friendly dynamic URLs
Of course, if the URLs rewriting process looks too complicated and you don’t feel able to do it, you could continue to use dynamic URLs.
Back in 2008 Google published a blog post saying that you should avoid rewriting dynamic URLs, because if it’s not done correctly Google “might not be able to interpret the information correctly in all cases”. Sometimes you can do more damage than good if you do the do wrong URL rewriting.
But if you continue to use dynamic URLs you can try to make them more “SEO-friendly” by following these simple rules:
- Keep the parameters short – Each individual parameter has a specific number of characters (also called query parameter length) . You should keep the number of characters as low as possible.
For instance, the length of the query parameter in this example URL http://www.example.com/forums/thread.php?threadid=12345 is 5 characters.
There’s no an official rule about query parameters’ length or about the maximum number of characters that is accepted.
- Keep the number of parameters small – avoid using any unnecessary parameters and keep the number of parameters in each URL as small as possible.