Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #5603 (closed defect: untested)

Opened 2 years ago

Last modified 2 years ago

[PATCH] Ending Slash re-runs cached action

Reported by: sphogan@gmail.com Assigned to: bitsweat
Priority: normal Milestone: 1.2
Component: ActionPack Version: 1.1.1
Severity: normal Keywords: page cache apache
Cc:

Description

By adding: RewriteRule ^([^.]+)/$ $1.html [QSA]

right before: RewriteRule ^([^.]+)$ $1.html [QSA]

in the .htaccess file, it will eliminate the ending slash which means it will serve the cached page, if applicable. Basically, since the dollar sign signifies the end of the pattern, a slash character before it could only be a trailing slash and adding that rule means that Apache will ignore the slash if it exists.

As noted in Agile Web Development with Rails, this is a problem saying "Use :trailing_slash with caution if you use page or action caching. . . The extra slash reportedly confuses the caching algorithm."

Change History

07/05/06 17:36:41 changed by bitsweat

  • keywords set to page cache apache.
  • owner changed from David to bitsweat.
  • version set to 1.1.1.
  • component changed from Web to ActionPack.
  • milestone set to 1.2.

Does RewriteRule ^([^.]+)/?$ $1.html [QSA] work for you?

09/03/06 21:49:43 changed by bitsweat

  • status changed from new to closed.
  • resolution set to untested.