Hi i am a complete noob when it comes to apache and really would appreciate any help i can get. I am about to move a site from example.com to example.com.au it has 1600 pages indexed in google and was hoping not to have to write a rule for each page rather appened the .au to any request for that domain simmilar to a www. is it possible to do somthing simmiarl to the code below to add a .au to the domain name thanks in advanced Cheers Nick # For sites running on a port other than 80 RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteCond %{SERVER_PORT} !^80$ RewriteRule ^/(.*) http://www.example.com:%{SERVER_PORT}/$1 [L,R] # And for a site running on port 80 RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://www.example.com/$1 [L,R] Code (markup):
Hi Nick, Here is a .htaccess file that does what you want. AddHandler cgi-script .cgi #AddType application/x-httpd-cgi .cgi .pl #Options +Indexes +ExecCGI #DirectoryIndex index.cgi #AllowOverride Limit FileInfo Indexes RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com$ [OR] RewriteCond %{HTTP_HOST} ^www.example.com$ RewriteRule ^(.*)$ "http\:\/\/www\.example\.com\.au\/$1" [R=301,L] Code (markup): This also redirects the non-www to www but if you don't want this you can remove the [OR] RewriteCond %{HTTP_HOST} ^www.example.com$ part