htaccess for moving domain names

Apache uses .htaccess files as a way to make configuration changes on a per-directory (and subdirectories) basis. They are a powerful tool when it comes to moving folders of changed files or in my case domain name rewriting.

Currently I am using a short domain name (prsos.co.uk) as a redirect to a specific page on the full domain name petrescuesos.co.uk. In the past I've even used ColdFusion to do by putting something along the lines in my Application.cfm.

This still gives the browser/spider the correct http header but why waste cpu styles on even doing this when the web-server can handle it natively. Below is the Apache .htaccess I've just put in place.

#Turn rewrite onRewriteEngine on#Look at the HTTP_HOST and regex search for old domain namerewritecond %{http_host} ^(.*)prsos.co.uk [nc]# The rule. Change the http_host to the new domain location. NC means NoCaserewriterule ^(.*)$ http://www.petrescuesos.co.uk/index.cfm?action=pets.found [r=301,nc]
comments powered by Disqus