# About .html and .rhtml,database

**URL:** <https://www.ruby-forum.com/t/about-html-and-rhtml-database/139738>\
**Category:** Rails\
**Created:** [June 6, 2008, 4:17pm UTC](https://www.ruby-forum.com/t/about-html-and-rhtml-database/139738 "2008-06-06T16:17:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 6, 2008, 4:17pm UTC](https://www.ruby-forum.com/t/about-html-and-rhtml-database/139738/1 "2008-06-06T16:17:48Z")

</div>

how do i make a .html file in the root directory,for example,there is  
a cart project,how do make a index.html file containing the link to  
access the files that are in the app directory?  
when deploy a project,where the mysql database will be put on the  
server?when i develop my project,my database was in the  
C:\InstantRails\mysql\data directory.

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 6, 2008, 4:50pm UTC](https://www.ruby-forum.com/t/about-html-and-rhtml-database/139738/2 "2008-06-06T16:50:55Z")

</div>

> how do i make a .html file in the root directory,for example,there is  
> a cart project,how do make a index.html file containing the link to  
> access the files that are in the app directory?

Normaly you won’t do that. This would require to set at least read  
access to the app directory (or create an alias to it, anyway don’t  
allow people to read the app dir, since it contains your code)  
Plain html goes in the public folder, preferably a subfolder like /docs

link\_to(“load”, “/docs/myfile.html”)

But that’s exceptional, normaly you’ll html.erb files and serve them  
from your controller/action with the render command

> when deploy a project,where the mysql database will be put on the  
> server?when i develop my project,my database was in the  
> C:\InstantRails\mysql\data directory.

Whereever you want, the thing must not be on the same server. It’ll run  
on any machine and you’ll tell Rails how to access it in the configfile  
database.yml

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 9, 2008, 3:21pm UTC](https://www.ruby-forum.com/t/about-html-and-rhtml-database/139738/3 "2008-06-09T15:21:13Z")

</div>

Thorsten M. wrote:

> > how do i make a .html file in the root directory,for example,there is  
> > a cart project,how do make a index.html file containing the link to  
> > access the files that are in the app directory?
> 
> Normaly you won’t do that. This would require to set at least read  
> access to the app directory (or create an alias to it, anyway don’t  
> allow people to read the app dir, since it contains your code)  
> Plain html goes in the public folder, preferably a subfolder like /docs
> 
> link\_to(“load”, “/docs/myfile.html”)

Thank you a lot! link\_to(“load”, “/docs/myfile.html”) tell me how to  
access the .html files in the public directory.But i want an index.html  
file in the root directory that can access the .rhtml files in the app  
directory.I don’t like that,but my server provider ask me to have an  
index.html file in the public\_html directory that is an folder on the  
server.So i have to make an index.html as a home page to access my other  
files in the app direcrory.  
Can you help me to resolve that?

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 9, 2008, 3:41pm UTC](https://www.ruby-forum.com/t/about-html-and-rhtml-database/139738/4 "2008-06-09T15:41:08Z")

</div>

On Mon, Jun 9, 2008 at 9:21 AM, Guo Y.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> >

The only way you’ll be able to do this is to setup a specific route  
for “index.html” that forwards off to a controller. Any .html files  
you put in public/ are static only and not a part of the Rails stack  
(aka no Erb). If you have an example we can work with, we can try to  
figure out a solution for ya.

Jason

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 10, 2008, 11:34am UTC](https://www.ruby-forum.com/t/about-html-and-rhtml-database/139738/5 "2008-06-10T11:34:51Z")

</div>

Jason R. wrote:

> On Mon, Jun 9, 2008 at 9:21 AM, Guo Y.  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > >
> 
> The only way you’ll be able to do this is to setup a specific route  
> for “index.html” that forwards off to a controller. Any .html files  
> you put in public/ are static only and not a part of the Rails stack  
> (aka no Erb). If you have an example we can work with, we can try to  
> figure out a solution for ya.
> 
> Jason

I have attachted my project just containing the app directory.Please  
download it.Now i have uploaded my project as a whole in the public\_html  
directory on the server.My server provider also asks me to make an  
index.html in this public\_html direcrory so that it is treated as the  
home page.So when input the domain [www.omega.com](http://www.omega.com),the index.html will be  
showed in the browser.As a result ,i have to set the link in the  
index.html file to access other actions or .rhtml files. For example ,if  
i want access the index action in the store controller,how do i set a  
link in the .html file which is in the public\_html direcroty to access  
that action?

---

<div class="post-metadata">

**Author:** ![daociyiyou](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/0ea827/32.png) [@daociyiyou](https://www.ruby-forum.com/u/daociyiyou)\
**Post date:** [June 10, 2008, 12:06pm UTC](https://www.ruby-forum.com/t/about-html-and-rhtml-database/139738/6 "2008-06-10T12:06:03Z")

</div>

On 10 Jun 2008, at 10:34, Guo Y. wrote:

> > figure out a solution for ya.  
> > showed in the browser.As a result ,i have to set the link in the  
> > Don’t create an index.html if you don’t want one (you can use map.root  
> > (in routes.rb) to set what controller & action are displayed when the  
> > root of your site is accessed.

Fred
