RE: How to strip out the query parameter for specific URLs using mod_rewrite?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[PT,L] is not allowing caching. Seems like mod_cache treats it as a dynamic file, because of the query string.
I may have to live with the redirection option [R=301,L] unless there are some other alternatives that I can try out. At least mod_cache is able to cache the redirected url as it does not have a query string anymore. But there is round trip involved from the browser.

To Nick's question, the links are coming in the body of a JSP file, where a javascript is loading these XML files for some processing at browser end. I can give mod_substitute a try do modify the JSP output to tamper these links, but it would involve looking at the contents of each request searching for this pattern. It might cause a negative impact on performance.
I have no idea of ProxyHTMLURLMap, so not sure how to try that option. 

-----Original Message-----
From: Ben Johnson [mailto:ben@xxxxxxxxxxxxxxxx] 
Sent: Thursday, October 04, 2012 11:27 PM
To: users@xxxxxxxxxxxxxxxx
Subject: Re:  How to strip out the query parameter for specific URLs using mod_rewrite?



On 10/4/2012 12:01 PM, Bhattacharya, Sudip wrote:
> Great. This one worked.
> 
> However, it looks like the first request with the query string returns a 301 moved permanently response, requiring another request from the browser to the file without the query string.
> 
> Can this redirection be avoided, so that the server returns the cached file on the original response only?

Just change the last line to the following (to use Pass-Through, instead of Redirecting with a specific status code):

RewriteRule ^(.*)$ %{REQUEST_URI}? [PT,L]

P.S. I can't speak to Nick Kew's comments (I don't use mod_cache), so you'll just have to test this and see if it works for your purposes.

Good luck,

-Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx

This e-mail (and any attachments), is confidential and may be privileged. It may be read, copied and used only
by intended recipients. Unauthorized access to this e-mail (or attachments) and disclosure or copying of its 
contents or any action taken in reliance on it is unlawful. Unintended recipients must notify the sender immediately 
by e-mail/phone & delete it from their system without making any copies or disclosing it to a third person.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux