.htaccess: Redirect old site to new one

When you move your website to a new domain, you may wanna redirect people to the new domain, so you don’t have to build your traffic all over again. Add this to your .htaccess on your old website: RewriteEngine on RewriteCond %{REQUEST_URI} !http://brand-new-website.com/ RewriteRule $ http://brand-new-website/ [R=301,L]

Git::Basic settings

Add .git_completion.sh to your home directory, and add this to your .bash_profile:   source ~/.git_completion.sh function parse_git_dirty { [[ $(git status 2> /dev/null | tail -n1) != “nothing to commit (working directory clean)” ]] && echo "*" } function parse_git_branch { git branch –no-color 2> /dev/null | sed -e '/^[^*]/d’… Continue reading

Linux: Runlevel configuration tool to start service on Ubuntu/Debian

Under Debian or Ubuntu based distro, use the runlevel configuration tool to manage services run levels To turn on mongodb service, use the following command: update-rc.d mongodb defaults you may to sudo: sudo update-rc.d mongodb defaults To remove service, use update-rc.d mongodb defaults or using sudo: sudo update-rc.d mongodb defaults

Windows 7: Emulate CD/DVD Media on your machine.

Windows 7: Emulate CD/DVD Media on your machine. I have been happy with Virtual CloneDrive for quite a while now. Today I stumbled upon a .NRG image that it won't mount as a drive and I wanted to have that image in a more popular format. After some hunting, I… Continue reading

Linux:: SSH configuration file

To save some typing you can create aliases to the servers you frequently access via ssh. This can be accomplished by either editing the global file ( /etc/ssh/ssh_config ), if you’re root and and to make changes for all the users, or your own config file ( $HOME/.ssh/config ). Follow… Continue reading

Squeeze: Setting up compiz on Debian Squeeze

My laptop has a nVidia Geforce 8660M GT, so I’m installing nVidia drivers follow this: http://wiki.debian.org/NvidiaGraphicsDrivers apt-get install module-assistant nvidia-kernel-common m-a auto-install nvidia-kernel${VERSION}-source Let’s go for the eye candy sudo apt-get install compiz compizconfig-settings-manager compiz-fusion-plugins-main Follow this: http://wiki.debian.org/Compiz

PHP 5: Mass Virtual Hosting points $_SERVER[‘DOCUMENT_ROOT’] to wrong folder

When I set up mass virtual hosting for my servers, it seems PHP won’t get the right $_SERVER[‘DOCUMENT_ROOT’] Here’s the solution I found: 1.Edit your php.ini (the file location depends on  how you have PHP setup) 2. Edit this section ; Automatically add files before PHP document. ; http://php.net/auto-prepend-file auto_prepend_file… Continue reading