views:

27

answers:

1

We have a server which has ScriptA.php, ScriptB.php and ScriptC.php which all contain text/images that are 80% similar.

We're using .htaccess to do url rewriting on ScriptC.php and we're noticing a performance slow down when it loads where it appears that the browser is loading the content afresh every time.

When I click on a link to ScriptB.php from www.example.com/ScriptA.php - there is hardly a noticable reload of the 80% common text/images when ScriptB.php is loading.

But when I click on a link to www.example.com/ScriptC.php/abcde-fghij-lmnop - the browser seems to reload the entire page which is a slow process.

Is that a known behavior? Is this a problem at the server end or the browser-end? How do I prevent this so that the user experience is smoother?

A: 

You might want to turn on RewriteLog to see what's happening. Rewrites can result in internal sub-processing, external redirection, or proxy throughput. Without knowing more about your setup & code (like whether embedded elements in ScriptC.php refer through ScriptC.php, are also subject to rewrites, etc) it's a bit hard to know what the cause is. Could it be a predicted side effect? Yup.

Potential situation: (wild guess)

If the images use relative paths, the way your rewrite rule example reads above the images will actually appear to the end-browser to be from a different URL/location (including ScriptC.php/) compared to ScriptA & ScriptB, which would lead to the local browser not using/knowing the data could already be in cache. Switching to absolute URLs may clear that right up.

mod_rewrite is very power... with great power comes... :)

Rudu
I did get the Logging turned on, but its displaying tons of data at level 5 itself... how do i figure out its taking it as the same domain and not loading content afresh?
matt_tm
It shouldn't load afresh if the URL of an object in the client browser is the same for both pages (eg. a JPG) Easiest way is to check the URL by viewing source from a browser on both `ScriptA` and `ScriptC` pages. If it's absolute they should match 100%, if it's relative you need to compare with respect to the URL as well. Should be able to learn from the log too, but without seeing (some of) it I can't be more specific.
Rudu