Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 639247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:49:16+00:00 2026-05-13T20:49:16+00:00

I have a file caching system for a php application. if a file needs

  • 0

I have a file caching system for a php application. if a file needs cached i save it to a cache dir as flat html mimicking the directory structure of the request_uri

how could i check with htaccess if there is a flat file in this cache dir before continuing as normal? currently i check with php, but ideally if there is a cached file, i would like to have no serverside code run on that request.

my current setup routes everything through the index file and then php determines what files to include based on the uri.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

so say that a request came in as

http://localhost/posts/45/the-name-of-my-post/
or
http://localhost/posts/45/the-name-of-my-post

how would i check to see if there is a flat html file located in

app/tmp/cache/posts/45/the-name-of-my-post/index.html

thanks and sorry if this is a stupid question, im fairly novice with rewrite rules. If anyone has a better idea how to elimimate php code from a cached request, im open to anything.

ok now trying

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond ^app/tmp/cache/%{REQUEST_URI} -d
RewriteRule (.*) ^app/tmp/cache/%{REQUEST_URI}

# map everything to the index file

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond ^app/tmp/cache/%{REQUEST_URI} !-d
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

tried this but doenst seem to be working, what am i overlooking?

my request is

 http://localhost/posts/view/23/another-post/

trying to serve up

http://localhost/app/tmp/cache/posts/view/23/another-post/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:49:17+00:00Added an answer on May 13, 2026 at 8:49 pm

    Try this:

    RewriteCond app/tmp/cache/%{REQUEST_URI} -d
    RewriteRule (.*) app/tmp/cache/%{REQUEST_URI}/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have a file caching system for a php 5 library i use often. when
In Yii, I have enabled APC caching through the config/main.php file: 'cache' => array(
In my root directory I have a htaccess file which is caching all sort
We have a simple binary file format for caching data in our application (C#
I have a caching class that has a flat file driver, meaning you can
I have a caching system build within php that stores the results of a
I have file with name contact.php, inside I have form: <form method=post name=kontakt action=send_mail.php>
I'm implementing an image cache system for caching downloaded image. My strategy is based
I have a bunch of simple lookup tables cached in my asp.net application since
I have a JTree implementation for directories in the file system. The problem I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.