Ruby on Rails Handy Guide

Some Useful command
To install ruby Gem,
gem install [gem_name]
eg, gem install rails

To install ruby Gem with certain version,
gem install [gem_name] –version=x.x.x
eg, gem install rails –version=2.3.5
eg, gem install rails -v=2.3.5

To update ruby Gem,
gem update [gem_name]
eg, gem update mysql

To update ruby Gem with latest version(for all)
gem update –system

To check missing gem
rake gems:install (must run from rails apps folder)

To install gem with lesser space
gem install –no-rdoc –no-ri [gem_name]
eg. gem install –no-rdoc –no-ri rails

To check RoR log,
Path: /home/[cpanel_username]/etc/rails_apps/[apps_name]/log

Continue reading Ruby on Rails Handy Guide

Redirect A Website with mod_rewrite

.htacess is very useful when you want to manage your website. It can be used to define the value that you want, block certain IPs, etc.

To redirect a website, you do not need to hard code from every single of your page, but you may use the .htaccess rewrite to get it done.

To redirect a domain name to www such as mickgenie.com to www.mickgenie.com

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mickgenie\.com$
RewriteRule ^(.*)$ http://www.mickgenie.com [R=301,L]

To redirect mickgenie.com and www.mickgenie.com to www.mickgenie.com

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.mickgenie\.com$ [OR]
RewriteCond %{HTTP_HOST} ^mickgenie\.com$
RewriteRule ^(.*)$ http://www.mickgenie.com [R=301,L]