Forum Moderators: coopster

Message Too Old, No Replies

How can you cache a PHP Page

How do I turn a dynamic PHP page into a static page that updates?

         

zander213

7:08 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



I am developing a site in PHP, but I would like the output pages to be static with different names for SEO purposes.

Ex:

Going from this: /catalog.php?sectionid=1&section=men&id=5&brand=&brand=40

To this: /category/product.php or html

Thanks in advance for any help!

dkin

7:16 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



I believe this would need mod rewrite or mod alias.

Try this forum see id it helps.

[webmasterworld.com...]

Nikke

7:23 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



Or, if you have owner access to the server, save the content of the page as a static file somewhere when you publish a new database entry.
Simultaneously save a small file called /category/product.php that sets the right variables
<?
$sectionid=1;
$section=men;
$id=5;
$brand=40;
?>

Of course, I'd guess that $id is the stuff you are fetching as content, so that might be $stuff2include="productStuff.php"

Then make sure to include your template file (index.php) which gets the approriate menues and navigational stuff.

lazydog

11:05 pm on Aug 23, 2004 (gmt 0)

10+ Year Member



You can also do this -

1. Add this directive in your apache conf file -
<Location /category>
ForceType application/x-httpd-php
</Location>

2. rename your category.php to category (without the extension)

3. Now pass your variables in the url as -
some-domain.com/category/product1/brandx/price.html

That's it. You can now process the url using the php variable "REQUEST_URI"

Hope that helps.

Saurabh.