Jump to content


Photo

Help with "static html generation with php"


  • Please log in to reply
8 replies to this topic

#1 phbock

phbock
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 17 July 2006 - 09:41 AM

Hi folks,

sorry to post this here but the discussion board around the tutorial "static html generation with php" has been quite inactive lately.

So here my task:
I have a php mysql script that is both slow and has some serious SEO problems (buying.php?cat=12... is not very keywordfriendly, and then google runs into some trouble that actually result in db errors being cached by google and not the content).

So I want to translate all the non member specific parts (so the public parts) of the site to static from dynamic. I have read the tutorial over and over again, but not being an expert (just enough to be dangerous:-) I did not understand one major point.

Here is WHAT I understand so far:
The proposed script runs the php, reads the output and then basically saves it as html in a folder hierarchy. No?

But (now my quesiton) HOW THE HECK do the links on the various (now html) pages look? They still link to buying.php?cat=12...?!?

So no working site is created in the end just by the script. I still need to translate all the links in newly created html code from buying.php?cat=12... e.g. to buying/cat-12/... True?

thx for your help
Phillip

#2 phbock

phbock
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 July 2006 - 04:16 AM

Me again, tha author of this thread,

given that I did not have any replies on this, maybe the forum I posted this in is too generic for that kind of question.

Would you have any idea where to post this for a better chance of help?

thx a lot
Phillip

#3 corbin

corbin
  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 18 July 2006 - 04:28 AM

I would think that you would have to change the links as well... But, if the content is being dynamicly generated it should be fairly simple to change the links shouldnt it?
Why doesn't anyone ever say hi, hey, or whad up world?

#4 phbock

phbock
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 July 2006 - 09:50 AM

Yeah :(

That's what I feared. Thx for the confirmation.

It might be fairlz simple, or not. I will need to think about this (the script is huge, but there is a class that prints the html output, and there I might do something)

thx however
Phillip

#5 designationlocutus

designationlocutus
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 18 July 2006 - 03:07 PM

Hmm how about a redirect?

Each item in your database still does have its primary key. You generate your title the same way your HTML generator does based on what is returned from the primary key and simply redirect it.

- link clicked
- get id
- retrieve record from db
- use title or whatever used to create redirect e.g. title.html
- redirect to title.html

That way you wont have to go through all the description part of you database searching for old links :)

#6 phbock

phbock
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 July 2006 - 04:49 PM

designationlocutus,

great idea!!!

But wouldn't the search engines be surprised to follow a link '/rfp.php?cmd=myproduct&item=25' and then find a page called /my-great-product-25??

thx
Phillip

#7 designationlocutus

designationlocutus
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts

Posted 19 July 2006 - 10:24 AM

The search engines would go to the processing page just as a visitor would and be redirected in the same way. Remember it's all done server side and the search engines won't notice until the actual HTML has been created.

The newly created URL will be the one that is indexed. :)

#8 ShogunWarrior

ShogunWarrior
  • Members
  • PipPipPip
  • Advanced Member
  • 528 posts
  • LocationIreland

Posted 19 July 2006 - 10:48 AM

What you could do is have a function that creates the cached URLS.
So, for example:
function nice_url($category,$id)
{
  return($category.'/'.$id);
}

Then, when you are caching a page, instead of inserting ?category=tutorials etc. you can insert nice_url($category,$url);.
<a href="http://www.daviddora...nmedia.com/">My New Site/Blog</a> | <a href="http://www.daviddora...m/check/">Check your page for broken links/images/scripts</a>

Zend Certified Engineer
Follow me on Twitter: http://twitter.com/davidd

#9 chrisprse

chrisprse
  • Members
  • PipPipPip
  • Advanced Member
  • 39 posts
  • LocationUnited Kingdom

Posted 19 July 2006 - 12:51 PM

How about looking into mod rewrite...

Example:

RewriteEngine On
RewriteRule ^buying/cat/([0-9])$ buying.php?cat=$1

You will just need to change your links. For example, where you have: buying.php?cat=12, change this to: buying/cat/12

Place the above code in your .htaccess file

When someone, or Google visits: http://www.domain.com/buying/cat/12, it will read the content as if it was buying.php?cat=12, however the URL stays as /buying/cat/12 which makes it more friendly to all




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users