Jump to content

Archived

This topic is now archived and is closed to further replies.

phbock

Help with "static html generation with php"

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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. :)

Share this post


Link to post
Share on other sites
What you could do is have a function that creates the cached URLS.
So, for example:
[code]
function nice_url($category,$id)
{
  return($category.'/'.$id);
}[/code]

Then, when you are caching a page, instead of inserting [b]?category=tutorials[/b] etc. you can insert [b]nice_url($category,$url);[/b].

Share this post


Link to post
Share on other sites
How about looking into mod rewrite...

Example:

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

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.