phbock Posted July 17, 2006 Share Posted July 17, 2006 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 helpPhillip Quote Link to comment https://forums.phpfreaks.com/topic/14821-help-with-static-html-generation-with-php/ Share on other sites More sharing options...
phbock Posted July 18, 2006 Author Share Posted July 18, 2006 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 lotPhillip Quote Link to comment https://forums.phpfreaks.com/topic/14821-help-with-static-html-generation-with-php/#findComment-59784 Share on other sites More sharing options...
corbin Posted July 18, 2006 Share Posted July 18, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/14821-help-with-static-html-generation-with-php/#findComment-59788 Share on other sites More sharing options...
phbock Posted July 18, 2006 Author Share Posted July 18, 2006 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 howeverPhillip Quote Link to comment https://forums.phpfreaks.com/topic/14821-help-with-static-html-generation-with-php/#findComment-59847 Share on other sites More sharing options...
designationlocutus Posted July 18, 2006 Share Posted July 18, 2006 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.htmlThat way you wont have to go through all the description part of you database searching for old links :) Quote Link to comment https://forums.phpfreaks.com/topic/14821-help-with-static-html-generation-with-php/#findComment-59916 Share on other sites More sharing options...
phbock Posted July 18, 2006 Author Share Posted July 18, 2006 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??thxPhillip Quote Link to comment https://forums.phpfreaks.com/topic/14821-help-with-static-html-generation-with-php/#findComment-59966 Share on other sites More sharing options...
designationlocutus Posted July 19, 2006 Share Posted July 19, 2006 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. :) Quote Link to comment https://forums.phpfreaks.com/topic/14821-help-with-static-html-generation-with-php/#findComment-60391 Share on other sites More sharing options...
ShogunWarrior Posted July 19, 2006 Share Posted July 19, 2006 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]. Quote Link to comment https://forums.phpfreaks.com/topic/14821-help-with-static-html-generation-with-php/#findComment-60402 Share on other sites More sharing options...
chrisprse Posted July 19, 2006 Share Posted July 19, 2006 How about looking into mod rewrite...Example:[CODE]RewriteEngine OnRewriteRule ^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/12Place the above code in your .htaccess fileWhen 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 Quote Link to comment https://forums.phpfreaks.com/topic/14821-help-with-static-html-generation-with-php/#findComment-60429 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.