Howdy folks - to me this seems a no-brainer; it can't be done. My boss wants the majority of our new site to be static html so that google et al will rank the pages, but he also wants to make the site searchable. Now we could use the lame google search tool, which is free but contains ads and is google. Is it possible to use php and mysql in conjunction to allow the site to be searchable? We provide training courses so the pages have to be searchable.
I suppose one idea would be to make a db with a field for the page title, description, keywords, content and a link to the original html page and build some php code that searches against this table for inputted keywords and produces a list of matching content and links. The links will then go to the original html pages. Is this how the google engine works?
frank
Odd request - searching a static site
Moderator: General Moderators
-
sleazyfrank
- Forum Commoner
- Posts: 40
- Joined: Fri Aug 19, 2005 3:59 am
- Location: Horsham, West Sussex
-
sleazyfrank
- Forum Commoner
- Posts: 40
- Joined: Fri Aug 19, 2005 3:59 am
- Location: Horsham, West Sussex
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Let me give you an example of how you can have dynamic pages that will trick google into thinking the pages are static.
Well lets say you have a news page which only holds the latest 4 news article, obviously a dynamic page and google will not index this very well. Well at the bottom of each of the articles you should provide a "permanant link" to the article.. so google can cache this and it will never change. Same applies to all other dynamic pages, provide a permanent link to all dynamic content so google can read through it.
Now lets move on to .htaccess. We all know that google doesn't like query strings very much, so the internet gods invented something called mod rewrite -- dwhich is basically rewritting the URL however we like it.. in this instance how GOOGLE likes it (html pages). Well your going to have to modify your site files files a bit to output the proper URLS, but something along the lines of
http://domain.com/news_14.html
in htaccess
Now let me explain that a bit.. this will match any link to /pagenamehere_idnamehere.html to ?goto=pagenamehere&id=idnamehere.
The page name has to be all letters and the id has to numerical or it won't match. You can also ignore the id and it will just match the page name. You also may have noticed the [L] and that is there to stop htaccess from going down the list of rules if it that particular one matches
Well lets say you have a news page which only holds the latest 4 news article, obviously a dynamic page and google will not index this very well. Well at the bottom of each of the articles you should provide a "permanant link" to the article.. so google can cache this and it will never change. Same applies to all other dynamic pages, provide a permanent link to all dynamic content so google can read through it.
Now lets move on to .htaccess. We all know that google doesn't like query strings very much, so the internet gods invented something called mod rewrite -- dwhich is basically rewritting the URL however we like it.. in this instance how GOOGLE likes it (html pages). Well your going to have to modify your site files files a bit to output the proper URLS, but something along the lines of
http://domain.com/news_14.html
in htaccess
Code: Select all
Rewrite Engine ON
Rewrite Base /
Rewrite Rule ^([a-zA-Z]+).html$ /?goto=$1 [L]
Rewrite Rule ^([a-zA-Z]+)_([0-9]+).html$ /?goto=$1&id=$2The page name has to be all letters and the id has to numerical or it won't match. You can also ignore the id and it will just match the page name. You also may have noticed the [L] and that is there to stop htaccess from going down the list of rules if it that particular one matches