Apache and mod-rewrite – redirecting a folder to new server

If you ever need to move one (or more) subdirectories, but not an entire site over to a new webserver, and you want to redirect the traffic, here’s how you can do it:


RewriteEngine On
RewriteRule ^directory_name(.*)$ http://www.example.com/directory_name [R=301,NC,L]

If you have multiple virtual hosts on the site, you might want to specify which host name’s directory_name should get sent to new server www.example.com

RewriteEngine On
RewriteCond %{HTTP_HOST} ^markcerv.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.markcerv.com$
RewriteRule ^directory_name(.*)$ http://www.example.com/directory_name [R=301,NC,L]

On Ubuntu 13+ and higher, /etc/bash_completion.d/git is now git-prompt

In this previous post I wrote about how to get some git branch information into your shell. That was written back when Ubuntu 12 LTS was the standard.

I recently upgraded a box to Ubuntu 16 LTS, and this information went away. 🙁

I discovered via trial and error, that the call that’s needed in .bashrc is now:

## To show you what branch you are in as you move around git repos
##
if [ -f /etc/bash_completion.d/git-prompt ]; then
. /etc/bash_completion.d/git-prompt
PS1='\[\u@\h \e[33m\]\w\[\e[0m\] $(__git_ps1 " (%s)")\n\$ '
fi


/etc/bash_completion.d/git is now: /etc/bash_completion.d/git-prompt