Jump to content

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
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 :)
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. :)
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].
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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.