homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Create Cache File From Http Host And Request Uri
Create Cache File From Http_Host And Request_Uri

 4:57 pm on Dec 23, 2012 (gmt 0)

Hello ;

I am writing a piece of code to create cache files from a certain site and all its pages. Because we display different data from the database using server alias configuration we need to create cache files with http_host and request_uri combined. Otherwise displayed cached will be displayed on wrong sites. I already created a piece of code, but does not work properly ... Here is the part with the problem:

$filename = "cache/".basename(rtrim($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"], '/')).".cache";

I would like the combine HTTP_HOST and REQUEST_URI into 1 filename, now it creates 2 files. 1 for index and 1 for every other page visited.

Thanks ;



 5:15 pm on Dec 23, 2012 (gmt 0)

Already found it :
$filename = "cache/".basename(rtrim($_SERVER["HTTP_HOST"], '/')).basename(rtrim($_SERVER["REQUEST_URI"], '/')).".cache";

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved