Take the 2-minute tour ×

How can I make it so that content from a database is available to search engines, like google, for indexing?


Table in mysql has a field named 'Headline' which equals 'BMW M3 2005'. My site name is 'MySite'

User enters 'BMW M3 2005 MySite' in google and the record will show up with results?

share|improve this question
The question still makes no sense. Please explain further. –  Alex Weinstein Nov 17 '09 at 13:22
I.e. database records don't ever show up in Google. What shows up in Google is web pages. Are you asking about how to create a web site that's searchable through Google? Or what? –  Alex Weinstein Nov 17 '09 at 13:23
the question is pretty clear, sorry that you dont understand it! here is the q again:How can I make records from a mysql table be found using google search engine?... blind? –  pesar Nov 17 '09 at 13:26
@pesar Assume for a moment Google could index public databases, what would the user see when they click a search results link? What page would they go to? A database is not a webserver so they wouldn't magically start browsing tables. That's what front-ends, and websites in general, are for. –  Mike B Nov 17 '09 at 13:53
Yup, I agree with the observation. The problem seems to be a lack of understanding of the Web, and not a programming question. –  MSalters Nov 17 '09 at 14:05
show 2 more comments

2 Answers

up vote 8 down vote accepted

Google indexes web pages, so you will need to have a page for each of your records, this doesn't mean to say you need to create 1,000 HTML pages, but following my advice above will dynamically / easily provide a seemingly unique page for each product.

For example:


You can use .htaccess to change this link to:


Within this script you can dynamically create each page with up-to-date information by querying your database based on the product id in this case 123.

Your script will provide each record with it's own title ('Nice BMW M3 2005'), a nice friendly URL ('www.mydomain.com/buy/123/nice-bmw-m3-2006') and you can include the correct meta information too, as well as images, reviews etc etc.

Job done, and you don't have to create hundreds of static HTML pages.

For more information on .htaccess, check out this tutorial.

share|improve this answer
Sorry, I dont understand what you mean, could you explain your solution a bit more? Whenever a user searches my site for ads, and a ad of choice is clicked, then php fetches info from mysql. Thats why this info has never been created before. But you suggest I create a html for every record? am I right? –  pesar Nov 17 '09 at 13:17
You asked how to have your records in your database show in in a Google search. So what I would suggest is to create a script (products.php) to fetch the product data (title, description, keywords etc), and dynamically populate a web page based on this information. For example, StackOverflow doesn't create hundreds of thousands of HTML pages for all their questions, they have one main template, and populate it with the dynamic information. You can use a cool trick within .htaccess to mask your products.php?id=123 as /buy/123/bmw-f800gs. This will make your URL friendly to search engines. –  Ben Everard Nov 17 '09 at 13:23
ok I understand all except the part to mask my 'products'. Does that mean that the meta-keywords and meta-description is created for all ads, but still only one html page? Do you have any link to an article about this, or tutorial? –  pesar Nov 17 '09 at 13:28
add comment

What ILMV is trying to explain is that you have to have HTML pages that Google and other search engines can 'crawl' in order for them to index your content.

Since your information is loading dynamically from a database, you will need to use a server-side language like PHP to dynamically load information from the database and then output that information to an HTML page.

You have any number of options for how to accomplish this specifically, ILMV's suggestion is one of the better ways though.

Basically what you need to do first is figure out how to pull the information from the database and then use PHP (or another server-side language) to output the information to an HTML page.

Then you will need to determine whether you want to use the uglier, default url style for php driven pages:


But this url is not very user or search engine friendly and will result in your content not being indexed very well.

Or you can use some sort of URL rewriting mechanism (mod_rewrite in a .htaccess file does this or you can look at more complex PHP oriented solutions like Zend Framework that provide what's called a Front Controller to handle mapping of all requests) to make it so that your url's look like:


This is what ILMV is talking about with regard to url masking.

Using this method of dynamically loading content will allow you to develop a single page to load the information for a number of different products based on the Id thus making it seem to the various search engines as though you have a unique page for each product.

share|improve this answer
good clarification... +1 –  Ben Everard Nov 17 '09 at 14:03
add comment

Your Answer


