The below instructions will guide you through redirecting an old site to a new site using htaccess.
For illustrative purposes the information below is based on:
Old Domain – cuc.org.au
New Domain – www.cuc.edu.au
If they have an IT company in charge of the domain name, best to hand this to them to configure otherwise if we own the domain, login to the Domain Name Registrar and edit the A-Records to point to the IP Address of our server host. In this case
A-Record – cuc.org.au = Our host IP Address
A-Record – www.cuc.org.au = Our host IP Address
DO NOT POINT NS RECORDS unless we are hosting emails and emails are transferred to our host. If emails are hosted and NS Records are changed, they will break.
Now head over to cPanel and then select “Addon Domains”. In the form fill out without the www. the domain. Subdomain and document root leave as is and then click add domain.
On the same screen after its created, find the addon domain created below and then click “manage redirection”. On this screen enter the new domain where the site sits. In this case it was https://www.cuc.edu.au/. Click save when complete.

Your addon domain should look like this if done correctly.

Now head over to the file manager and select the new addon domain’s folder. You want to create two files here:
- .htaccess – Copy code below for redirection into this file when created
- index.php – Just a blank file needed here.
Now inside .htaccess add the following code below. This will redirect all of cuc.org.au including inside pages to cuc.edu.au. It does mean that cuc.org.au/about will redirect to https://www.cuc.edu.au/about. If the page in the new site does not exist it will go to a 404. Edit the below snippet for with your domain you would like to redirect and save.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^cuc\.org\.au$ [OR]
RewriteCond %{HTTP_HOST} ^www\.cuc\.org\.au$
RewriteRule ^(.*)$ "https\:\/\/www\.cuc\.edu\.au\/$1" [R=301,L]
That should be all, if this done correctly then the old site should now be redirecting to the new site.
