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?

  • You could create a beautiful interface for "Find the right dog" or "Make a dog" and then maybe use the Wolfram-Alpha database to find places on a map near the visitor (geo-ip them) like pet shelters or stores that sell dogs of those colors?
    – ionFish
    May 13 '12 at 5:58
  • @ionFish My question was phrased poorly. I'm interested in getting my page indexed by search engines. May 13 '12 at 18:50

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:


you could have


This makes the URLs much easier to remember/type and tells the user that they can go to:


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.


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.

  • "If your site is currently using a form POST to search, and the results are not accessible by their own URLs..." This is indeed what I'm doing at the moment. If I switch to GET, will all pages (i.e. all possible search requests) be indexed by search engines, or just those that happen to be accessed frequently? May 13 '12 at 18:48
  • 1
    @Austin: All the ones that are crawlable could potentially be indexed; Google may choose to only crawl to a particular depth into your site, or they may crawl a page but choose to exclude it from the index (e.g. if it's duplicate content, low quality content, etc.). The more popular your site, the more likely everything will be indexed. The key thing is to make sure that users can easily get to all the pages you wish indexed simply by clicking links. This will ensure Google also finds those pages. Otherwise, you'll need to include them in your sitemap. May 13 '12 at 19:17
  • (Thank you for your attention to my question. I am a novice in these matters, and I appreciate your assistance.) I don't know if it will help, but here is my current design: www.austinmohr.com/spacebook. It's infeasible to make everything accessible via links because of the large number of search options (there are on the order of 10^13 possible searches). Will handling searches via GET still improve my search engine visibility, even if I can't make the pages reachable by links? May 13 '12 at 19:51
  • 1
    @Austin Mohr: With that number of options, what you probably want to do is to only link the main permutations that return non-empty results. All of your search options basically take the form of [topological property] is true|false|either. So the obvious pages to index would be example.com/topological-property and example.com/not-topological-property. And if you find that 2 properties are often being searched for concurrently, then you can also link to example.com/property1/property2 or example.com/property1/not-property2. May 14 '12 at 5:46
  • 1
    It will still be useful to handle searches via GET or at least a PRG because users will be able to bookmark and link to searches, which will also help your site get indexed. Making sure that there's plenty of search-engine-visible content is important as well. So on the pages for the individual properties, I would probably include a short description of that property, which is likely to naturally contain relevant search keywords that relate to that property and to the topic of your site. May 14 '12 at 5:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.