If you are running Apache for your web server, and mod_rewrite is installed (this is a pretty typicaly module on all installations) this is actually pretty easy.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.yourdomain\.com
RewriteRule ^(.*)$ http://www\.yourdomain\.com/subdomain/$1 [L]

Add this code to your apache configuration file – the easiest location is in the .htaccess file in your root web directory. This should redirect the browser with a 302 Found message.

You can do some pretty fancy things with mod_rewrite, but this is simple and gets the job done!

1 comment
  1. Pingback: Dave Drager

Comments are closed.

You May Also Like

Delete all directories more than a week old

This simple linux bash script will delete subdirectories in a directory based…

Why ISPs Need To Have Unrestricted P2P Traffic

Names like Comcast, Verizon, SBC, RoadRunner, Cox, Charter – control the vast…

How To Turn Off Your Monitor Via Command Line in Ubuntu

As previously written on this blog, I have set up a display…

Post on Makeuseof: Keeping Safe on the Web: 8 Firefox Addons for Privacy and Security

I have a new post up on Makeuseof, regarding Firefox Addons for…