: Search Engine Indexing of a Database-Driven Website Suppose I have a MySQL whose rows are dog breeds and whose columns are properties of the breeds (e.g. coat color). The purpose of the site
Suppose I have a MySQL whose rows are dog breeds and whose columns are properties of the breeds (e.g. coat color). The purpose of the site is to allow users to query the database with questions like "Which breeds can have a brown coat?". The site would then use PHP to form a query and display the breeds from the database having brown coats.
Since there is no information present on the page until the user requests it, how can a search engine index such a site? Ideally, I would like my site to pop up in Google searches like "dog breeds brown coat".
My only idea is to have a separate page with the database permanently dumped out as text, then have that page redirect to the site's main page (where the user can make the query). Is this an effective strategy? Are there better ways?
More posts by @Angela700
1 Comments
Sorted by latest first Latest Oldest Best
A database-driven site doesn't necessarily have to have only a single URL or be entirely search-based. Most sites on the web today (including SE) are database-driven, but they still have different pages with individual URLs. And even search-based sites can be made to be search-engine-friendly.
Your site should have a RESTful architecture wherever possible. And since these are search results rather than idempotent operations, you can easily have a stateless public application that is accessed entirely via GET rather than POST.
There is nothing wrong with linking to and letting the search engine index common search results like:
example.com/search.php?coatcolor=brown
example.com/search.php?coatcolor=black
example.com/search.php?coatcolor=white
...
example.com/search.php?coatcolor=black&spots=white
example.com/search.php?coatcolor=white&spots=black
example.com/search.php?coatcolor=white&spots=brown
...
If your site is currently using a form POST to search, and the results are not accessible by their own URLs, then you're breaking fundamental rules of usability. Users won't be able to navigate using history buttons, bookmark their search results, or link to them to send to other people.
Also, another way to look at it is that all database-driven sites are search-based. When someone requests a specific post on a Wordpress blog, WP is searching for a particular article (by ID or slug) as well as the comments which are tied to that article. But that doesn't stop WP from being able to have links and URLs for individual articles.
Likewise, your site would probably be more useful if users can browse the site by dog breeds as well as different dog attributes (coat color, coat type, etc.). After all, some people may classify a color as brown while another classifies it as tan or hazel. Having a list of all colors available (with links to each one) makes it much easier for users to find the info they want without any ambiguity or trial and error guessing.
After that, you just need to route or rewrite your URLs to make them more user-friendly. Instead of:
example.com/search.php?coatcolor=black&pattern=spotted
example.com/search.php?coat=long
example.com/search.php?breed=papillon
example.com/search.php?colors=black,white,brown
you could have
example.com/coatcolor/black/spotted
example.com/coat/long
example.com/breed/papillon
example.com/color/black-white-brown
This makes the URLs much easier to remember/type and tells the user that they can go to:
example.com/coatcolor
example.com/coat
example.com/breed
example.com/color
...
To see a directory of each attribute category. Linking to these category pages from your homepage or main navigation will also ensure that search engines can crawl/index most of your database.
Even if for some reason your site's search is really CPU-intensive and you need to put the search function behind a form POST to prevent the user from casually retriggering the search when using the back/forward buttons, you can still use a PRG pattern + full-page caching to make results bookmarkable/linkable while still using a POST form.
Edit:
If you have a very large amount of potential searchs, it is still useful to have user-friendly RESTful URLs for the search results for usability reasons as well as SEO. In terms of SEO, aside from focusing on searches that actually contain results, you can link to the most popular/most recent searches. If you do this, Google will eventually index all of your important search pages, even if you no longer link to them.
Having an always-changing Popular Searches or Recent Searches page/section is also a good strategy to gradually expose all of your content to Google because it looks like you're updating/adding content to your site regularly.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.