# Get rid of the "public"

**URL:** <https://www.ruby-forum.com/t/get-rid-of-the-public/77800>\
**Category:** Rails\
**Created:** [March 7, 2006, 12:37pm UTC](https://www.ruby-forum.com/t/get-rid-of-the-public/77800 "2006-03-07T12:37:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunohodov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b38774/32.png) [@lunohodov](https://www.ruby-forum.com/u/lunohodov)\
**Post date:** [March 7, 2006, 12:37pm UTC](https://www.ruby-forum.com/t/get-rid-of-the-public/77800/1 "2006-03-07T12:37:04Z")

</div>

Hello to all!

First I want to appologize if this topic has been already discussed but  
the search does not work 🙂

I have RoR installed on a shared server. I also have a RoR application  
installed in a subdomain. The structure is as follows:

www //this is my home WWW folder  
±-- www //maps to [www.mydomain.com](http://www.mydomain.com)  
|  
±-- webapp //maps to [webapp.mydomain.com](http://webapp.mydomain.com). Here is my RoR application  
| ±-- app  
| ±-- components  
| ±-- config  
| ±-- db  
| ±-- lib  
| ±-- log  
| ±-- public  
| ±-- script  
| ±-- themes  
| ±-- vendor  
|  
±-- anothersubdomain // maps to [anothersubdomain.mydomain.com](http://anothersubdomain.mydomain.com)

As shown above my RoR application is installed in the webapp folder. I  
do not have other RoR applications installed.

Is there a way to get rid of the “/public” in my url’s? I read all the  
tutorials at [Peak Obsession](http://wiki.rubyonrails.com/rails/pages/Howtos) but I just  
can not manage to make it. I am going to hang myself on the next tree…  
I just need a concrete example. Can someone help me?

Thank you in advance!

Regards

---

<div class="post-metadata">

**Author:** ![lunohodov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b38774/32.png) [@lunohodov](https://www.ruby-forum.com/u/lunohodov)\
**Post date:** [March 7, 2006, 12:52pm UTC](https://www.ruby-forum.com/t/get-rid-of-the-public/77800/2 "2006-03-07T12:52:51Z")

</div>

Hm, that setup seems to open big security breach:  
is [http://webapp.mydomain.com/config/database.yml](http://webapp.mydomain.com/config/database.yml) visible?

Advise: don’t place your code under website document root.

It should be possible to place there only contents of your “public”  
dir, and the rest of your app - somewhere outside webroot, e.g.  
/home/you/rails-app, with symlink /home/you/rails-app/public →   
www/webapp.mydomain.com/

---

<div class="post-metadata">

**Author:** ![lunohodov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b38774/32.png) [@lunohodov](https://www.ruby-forum.com/u/lunohodov)\
**Post date:** [March 7, 2006, 2:52pm UTC](https://www.ruby-forum.com/t/get-rid-of-the-public/77800/3 "2006-03-07T14:52:13Z")

</div>

Lugovoi N. wrote:

> Hm, that setup seems to open big security breach:  
> is [http://webapp.mydomain.com/config/database.yml](http://webapp.mydomain.com/config/database.yml) visible?
> 
> Advise: don’t place your code under website document root.
> 
> It should be possible to place there only contents of your “public”  
> dir, and the rest of your app - somewhere outside webroot, e.g.  
> /home/you/rails-app, with symlink /home/you/rails-app/public →   
> www/webapp.mydomain.com/

Thank you for the advise! I have used .htaccess files to secure the  
sensible data. Unfortunatelly it is not possible to use symlinks… Is  
there another way ot solving my problem?

Regards

---

<div class="post-metadata">

**Author:** ![lunohodov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b38774/32.png) [@lunohodov](https://www.ruby-forum.com/u/lunohodov)\
**Post date:** [March 7, 2006, 3:53pm UTC](https://www.ruby-forum.com/t/get-rid-of-the-public/77800/4 "2006-03-07T15:53:10Z")

</div>

Lunohod Lunohodov wrote:

> Thank you for the advise! I have used .htaccess files to secure the  
> sensible data. Unfortunatelly it is not possible to use symlinks… Is  
> there another way ot solving my problem?

Try mapping directly to your “public” directory, i.e:

[webapp.mydomoin.com](http://webapp.mydomoin.com) → /your/rails/app/public

– Marcus

---

<div class="post-metadata">

**Author:** ![lunohodov](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b38774/32.png) [@lunohodov](https://www.ruby-forum.com/u/lunohodov)\
**Post date:** [March 7, 2006, 3:28pm UTC](https://www.ruby-forum.com/t/get-rid-of-the-public/77800/5 "2006-03-07T15:28:35Z")

</div>

Can you configre your DNS so that webapp.mydomain points to  
/home/you/rails-app/public ?
