# Action caching and server aliases

**URL:** <https://www.ruby-forum.com/t/action-caching-and-server-aliases/112064>\
**Category:** Rails\
**Created:** [August 14, 2007, 9:37pm UTC](https://www.ruby-forum.com/t/action-caching-and-server-aliases/112064 "2007-08-14T21:37:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cleaner416](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/d26b3c/32.png) [@cleaner416](https://www.ruby-forum.com/u/cleaner416)\
**Post date:** [August 14, 2007, 9:37pm UTC](https://www.ruby-forum.com/t/action-caching-and-server-aliases/112064/1 "2007-08-14T21:37:00Z")

</div>

I’m having some trouble with caching (namely expiring action caches)  
on my production server:

I have a site that can be accessed by both [domain.com](http://domain.com) and  
[www.domain.com](http://www.domain.com).  
The problem is that pages cached through action caching are being put  
into both myapp/tmp/cache/domain.com and myapp/tmp/cache/  
[www.domain.com](http://www.domain.com). So when it comes to expiring those actions,  
depending on how the site is being accessed, only part of the actions  
are expired (either in myapp/tmp/cache/domain.com or myapp/tmp/cache/  
[www.domain.com](http://www.domain.com), but not both).

Is there some config variable I can set in environment.rb to omit the  
hostname from the caching mechanism? The API documentation seems  
sparse in this regard.

Thanks!

---

<div class="post-metadata">

**Author:** ![cleaner416](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/d26b3c/32.png) [@cleaner416](https://www.ruby-forum.com/u/cleaner416)\
**Post date:** [August 14, 2007, 9:43pm UTC](https://www.ruby-forum.com/t/action-caching-and-server-aliases/112064/2 "2007-08-14T21:43:00Z")

</div>

On 8/14/07, cleaner416 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> [www.domain.com](http://www.domain.com), but not both).
> 
> Is there some config variable I can set in environment.rb to omit the  
> hostname from the caching mechanism? The API documentation seems  
> sparse in this regard.

Is there some reason you’re using both domains? I’d setup a web  
server redirect for one domain to the other so you don’t split your  
google PR over 2 domains.

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![cleaner416](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/d26b3c/32.png) [@cleaner416](https://www.ruby-forum.com/u/cleaner416)\
**Post date:** [August 14, 2007, 10:02pm UTC](https://www.ruby-forum.com/t/action-caching-and-server-aliases/112064/3 "2007-08-14T22:02:03Z")

</div>

Thanks, Rick - of course that’s the correct solution.

---

<div class="post-metadata">

**Author:** ![cleaner416](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/d26b3c/32.png) [@cleaner416](https://www.ruby-forum.com/u/cleaner416)\
**Post date:** [August 14, 2007, 10:19pm UTC](https://www.ruby-forum.com/t/action-caching-and-server-aliases/112064/4 "2007-08-14T22:19:05Z")

</div>

> > > Is there some config variable I can set in environment.rb to omit the  
> > > hostname from the caching mechanism? The API documentation seems  
> > > sparse in this regard.
> > 
> > Is there some reason you’re using both domains? I’d setup a web  
> > server redirect for one domain to the other so you don’t split your  
> > google PR over 2 domains.

> Thanks, Rick - of course that’s the correct solution.

Be sure to use 301 redirects. Google _hates_ 302.

-philip
