The common way to deploy a Rails application is to create a subdomain and point it to the folder where your application lies. This works well for those subdomains as well as addon-domains, but what about your main domain? If you are someone like me who bought the hosting solution together with the domain, then you might wonder how you get your Rails app accessed under this domain.
This site is hosted on Bluehost and there is no facility to point the domain to a specific folder via a control panel. Therefore, there general sequence is as the following:rails myrailsappln -s ~/path/to/myrailsapp/public myrailsappOn the verge of getting this web site running I noticed, that all the links are still redirected to http://domain.com/myrailsapp/ instead of remaining at http://domain.com/. All would work, but that’s not what I wanted.
Therefore, I reached for a rather drastic approach: link the public_html/ directly to the myrailsapp/public/ folder:rails myrailsappmv public_html public_html-backupln -s ~/path/to/myrailsapp/public public_htmlThis all works pretty well for me. The only thing to mind is copying the subdomains/folders/files that are now in the old public_html-backup over to the new one. Since the new public_html is only a symbolic link to the rails app, it was actually copied into myrailsapp/public/. However, everything works as before.
Now, if you smite your forehead and say: “there’s a much better way”, then please let me know!