Copy link to clipboard
Copied
Would just appreciate some advice on this.
I've taken over a site that currently has a static page for several businesses listed
eg www.mywebsite.com/businessname/
These have all been created in Wordpress, and currently the only search function is using a Google Maps API to find businesses by location.
The plan now is to improve the search function, and so I'm thinking the site is ripe to have a database developed, so that we can have any number of searchable fields.
At the moment a lot of the static pages do quite well with search engines, so I don't want to undo any of that if possible.
My understanding is that Google used to struggle with dynamc links like www.mywebsite.com/businesses?id=101, but can now handle them OK.
I've also sussed that I should be able to use the mod_rewrite engine to create URLs of the form www.mywebsite.com/businessname/
So my question is really how to best go about this and if possible a. use a database and b. retain the business name in the URL?
And I don't quite get how it works with the search engines, as I assume the individual URLs don't exist per se, but are only ever created on the fly when a user clicks through to a details page, rather than there being distinct pages on the server for Google to trawl through.
Thanks for any advice.
Copy link to clipboard
Copied
Firstly, Google has absolutely no problem with dynamic urls. Google follows the links through the menu system etc, pretty much as a user would.
You are saying you want to write a search routine to search the content stored in the database? Don't use LIKE. Read up on using the MATCH method for mySQL. Here is an example:
$query1=$dbh->prepare("SELECT *, MATCH(description, title, content) AGAINST (:term IN BOOLEAN MODE) AS score FROM pages WHERE MATCH(description, title, content) AGAINST (:term IN BOOLEAN MODE) ORDER BY score DESC") ;
You can use the business name in the url if you make them unique, so instead of using ?id=101 it can be ?id=businessname, then use a rewrite rule to turn the ?id= into a slash, making it look like the urls you now use.
Copy link to clipboard
Copied
Thanks Rob.
I'm still not quite sure how it works - although Google has no problem with dynamic URLs, I'm not sure how it sees them if they don't exist.
At the moment, if there's a static page www.mywebsite.com/businessname, it can find that URL in its physical location.
But with dynamic sites, there isn't a URL / file for each business, just a dynamically created one.
Or is Google clever enough to look them up and create each dynamic URL itself as part of its search?
ie can Google return a search result that is a dynamic URL?
This is important for the site owner, as at the moment businesses that are listed on his site are often returned quite well up the rankings.
Copy link to clipboard
Copied
"Can Google return a search result that is a dynamic URL?"
Absolutely.
When a person goes to a dynamically built website they have no idea that the whole thng is created on the fly as they navigate through it. It works just like an old fashioned site where the pages just sit there waiting for visitors (except better). As I explained already, Google just moves through the site the same way. Don't get hung up on this point. Virtually all of the important website on the internet are built dyanmically. If Google couldn't handle that fact, then Google would have died ten years ago.
"But with dynamic sites, there isn't a URL / file for each business, just a dynamically created one"
You are thinking in the wrong way. There is indeed a url for each business, it's dynamic.
Copy link to clipboard
Copied
>I'm still not quite sure how it works - although Google has no
>problem with dynamic URLs, I'm not sure how it sees them if
>they don't exist.
They do exist. But Google can only find them by spidering the site so there needs to be a link to each dynamic page.
>But with dynamic sites, there isn't a URL / file
>for each business, just a dynamically created one.
Sure there is. www.example.com/businesses?id=101 is a different url than www.example.com/businesses?id=102
>ie can Google return a search result that is a dynamic URL?
Of course it can. If you are using the rewrite engine, then google has no way of even knowing if the page is static or dynamic - nor does it care. If you're using dynamic pages with querystrings, then google might figure out that it's a dynamic page, but it still doesn't care. If a link on your site passes a different querystring to the page than another link, and different outputs are produced, it will index them.
Copy link to clipboard
Copied
Thanks - that makes sense now with the links existing on the site.
So if, for example, there was only a search page, which pulled up the businesses in a results page, that clicked through to each dynamic URL, that wouldn't work.
But if there are pages that list the businesses, and each entry is a link to the dynamic details page, that would be OK.
Copy link to clipboard
Copied
Right. A search mechanism won't help. You need to have a menu system or a page that lists all the dynamic urls. These can also be dynamic.
Copy link to clipboard
Copied
I think that's what I just said?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now