# Many Static Pages Across Various Domains

**URL:** <https://www.ruby-forum.com/t/many-static-pages-across-various-domains/125497>\
**Category:** Rails\
**Created:** [January 9, 2008, 6:03pm UTC](https://www.ruby-forum.com/t/many-static-pages-across-various-domains/125497 "2008-01-09T18:03:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kopf1988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/74df32/32.png) [@kopf1988](https://www.ruby-forum.com/u/kopf1988)\
**Post date:** [January 9, 2008, 6:03pm UTC](https://www.ruby-forum.com/t/many-static-pages-across-various-domains/125497/1 "2008-01-09T18:03:56Z")

</div>

Alright, what would be the best practice for this?:

I have several domains, like

> **[Learn the real truth about Ryan Kopf and his anime cons here.](http://www.ryankopf.com)**
>
> Official website of Ryan Kopf. Features videos, projects, and news. Help Ryan Kopf build a world filled with free information and creativity.

[www.cmuscatine.com](http://www.cmuscatine.com)

> **[Anime Pictures and Anime Convention Pictures | Anime Pictures](http://www.aiowa.com)**
>
> AYour source for anime pictures, images, screenshots, and more, focusing on anime convention pictures and cosplay photo galleries.

Some have lots of static pages (first two) but others are more dynamic  
(picture gallery on the third one). I am working on re-implementing  
them in RoR on my GoDaddy apache shared hosting server.

I want to have just one ruby application, because I have features that  
I’m going to want to use across the board… but I’m trying to figure  
out the best way to do this.

It was suggested just to create a static.rb controller, then in views/  
static/ put the pages as .rhtml. Then I would use apache’s mod\_rewrite  
or something like that to direct  
[www.ryankopf.com/ryan\_kopf\_static/page.html](http://www.ryankopf.com/ryan_kopf_static/page.html)  
to the RoR program. But I have layouts in place on each site, and each  
is different, so wouldn’t I have to create a new controller for each  
website? (I use just one file for the layout so that I can easily  
change it). What’s the don’t-repeat-yourself method of doing this?

---

<div class="post-metadata">

**Author:** ![kopf1988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/74df32/32.png) [@kopf1988](https://www.ruby-forum.com/u/kopf1988)\
**Post date:** [January 9, 2008, 10:29pm UTC](https://www.ruby-forum.com/t/many-static-pages-across-various-domains/125497/2 "2008-01-09T22:29:00Z")

</div>

You can specify a layout when you render an action, so you could have a  
single controller.

render :action =\> ‘whatever’, :layout =\> ‘layout1’

---

<div class="post-metadata">

**Author:** ![kopf1988](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/74df32/32.png) [@kopf1988](https://www.ruby-forum.com/u/kopf1988)\
**Post date:** [January 10, 2008, 7:30pm UTC](https://www.ruby-forum.com/t/many-static-pages-across-various-domains/125497/3 "2008-01-10T19:30:26Z")

</div>

Okay. Is there a way I can figure out which domain is calling? Then I  
could get really simple and define a Website model. The attributes  
would be  
:layout - \>name of layout  
:pagename - \> page file location  
(example :homepage -\> “/views/Website/ryankopf/homepage.txt”)

Is that in the environment somewhere maybe?

On Jan 9, 3:29 pm, Jeremy Weiskotten \<rails-mailing-l…@andreas-
