So I wish to keep my cached pages inside a folder known as /cache

and I believed to achieve the generic url

example.com/not a real folder

quietly redirect to

example.com/cache/not-a-real-folder.html

and when the above mentioned file doesn't exist get it redirect to

index.php?page=not a real folder 

but how do you design the Apache Mod Rewrite code that is going to do all of this, could it be even possible?

I am a new comer to this stuff so any help could be greatly appreciated! Many thanks!

# First check if the file requested exists in the cache folder,
# if it does, rewrite the url to the cached version
# -The %{REQUEST_URI} will probably start with a '/'
RewriteCond /cache%{REQUEST_URI} -f
RewriteRule (.*) /cache$1.html [L,NC]

# If the request makes it here, the file requested is not in the cache,
# so we can rewrite the request to the index.php page for processing
RewriteRule (.*) /index.php?page=$1 [L]

For clairification, are the demands arriving with spaces, and also you need them rewritten with dashes? Because that contributes more complexity...

Hope this can help.