cached mod_rewrite question

Discuss practical ways rearrange URLs using mod_rewrite.

Postby ehappylucky05 » Thu Nov 13, 2008 8:38 am

hi richard,
thanks for your help. Basically, my web site is a database driven web site with dynamic content, in order to optimize the server performance, the module create a cached copy of all content under the "cache" folder, as shown in the example in the threads above. This will allow all non-login user to load the page faster without going through the database query http request.

I've tried your code, still, the following part is not working.
Code: Select all
RewriteCond %{REQUEST_URI} ^(/.*[^/])/?$
RewriteCond /srv/www/htdocs/whatever/cache/mysite.com/0%1.html -f
RewriteRule !^cache(/.*)?$ /whatever/cache/mysite.com/0%1.html [L]


I also tweaked the code few times to make it looks like below, but still not working, the htaccess is under /whatever/ (just for clarification, i did replace mysite.com with my server name):

Code: Select all
RewriteCond %{REQUEST_URI} ^(/.*[^/])/?$
RewriteCond /srv/www/htdocs/whatever/cache/mysite.com/0/node/0%1.html -f
RewriteRule !^cache(/.*)?$ /whatever/cache/mysite.com/0/node/0%1.html [L]


Code: Select all
RewriteCond %{REQUEST_URI} ^(/.*[^/])/?$
RewriteCond /srv/www/htdocs/whatever/cache/mysite.com/0/%1.html -f
RewriteRule !^cache(/.*)?$ /whatever/cache/mysite.com/0/%1.html [L]


Code: Select all
RewriteCond %{REQUEST_URI} ^$
RewriteCond /srv/www/htdocs/whatever/cache/%{SERVER_NAME}/0%{REQUEST_URI}.html -f
RewriteRule ^(.*)$ /whatever/cache/%{SERVER_NAME}/0/$1.html [L]


Please advice
I really really appreciate your help!
Thanks a million
ehappylucky05
 
Posts: 14
Joined: Tue Aug 19, 2008 8:02 am

Postby richardk » Fri Nov 14, 2008 1:01 pm

Try
Code: Select all
ptions +FollowSymLinks

RewriteEngine On

RewriteCond /srv/www/htdocs/whatever/cache/mysite.com/0/index.html -f
RewriteRule ^$ /whatever/cache/mysite.com/0/index.html [L]

RewriteCond %{REQUEST_URI} ^/whatever(/.*[^/])/?$
RewriteCond /srv/www/htdocs/whatever/cache/mysite.com/0%1.html -f
RewriteRule !^cache(/.*)?$ /whatever/cache/mysite.com/0%1.html [L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby ehappylucky05 » Mon Nov 17, 2008 1:19 pm

Hi Richard,
Thanks a lot!
Wish you a wonderful thanksgiving ;-)
ehappylucky05
 
Posts: 14
Joined: Tue Aug 19, 2008 8:02 am

Previous

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: Google [Bot] and 19 guests

cron