View Single Post

  #2 (permalink)  
Old 09-30-2004
Justin Koivisto
 
Posts: n/a
Default Re: mod_rewrite On-the-fly Content-Regeneration not working

DrTebi wrote:

> Hello,
> After reading the URL rewriting guide and several other documents, I
> still haven't figured this out.
> Basically this what I am trying to approach:
> - User requests domain.com/page.html
> - mod_rewrite checks if requested page exists in
> domain.com/static/page.html
> - if page does exist, it's served
> - if it does not exist, mod_rewrite redirects to domain.com/page.php
> - domain.com/page.php generates domain.com/static/page.html
>
> So, assuming the original URL is domain.com/page.html
> here are my last two (failed) attempts:
> # Attempt 1:
> # enable the rewrite module
> RewriteEngine on
>
> # use static html file if exists (from static/)
> RewriteRule ^(.*)\.html$ $1 [C,E=WasHTML:yes]
>
> RewriteCond static%{REQUEST_FILENAME}.html -f
> RewriteRule ^(.*)$ static$1.html [S=1]


Did you try the following at all?

RewriteCond static/%{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ static/$1.html [S=1]

--
Justin Koivisto - spam@koivi.com
http://www.koivi.com