how to combine .com and .co.za

Japster

Well-Known Member
Joined
Mar 6, 2009
Messages
468
Reaction score
0
Location
Johannesburg
Hi Guys

I have registered 2 domains, a .com and a .co.za, I will be developing 1 website that I will host on the .co.za domain. What do I need to redirect a person to my .co.za domain/site if they use the url with the .com extension. I have never done something like this before.

I'm using Afrihost if that is important to know.
 
Just have the a record in the . Com domain be a cname to the name in Coza. Then in your hosting just make sure both names are in your virtual host configuration, or in the . Com site have a redirect to the coza.
 
Sorry for all these questions, but Im lost here...lol When I register the domains, do I provide the cname to afrihost in the .com of my .co.za address? I have no idea where to do these things. Sorry if the questions are dumb.
 
Certainly not a dumb question, I also learnt something here...
My current hosting company has the gall to tell me this is NOT ALLOWED on their hosting packages.
 
You could set a 301 Permanent Redirect from the .com to the .co.za.
This is usually done via the control panel.
Alternatively, you can have the DNS records updated to the CNAME of the .co.za, as sinbad has said above.
3rd option - message AH support and ask them to configure it. Not sure how good their support is...
 
You could set a 301 Permanent Redirect from the .com to the .co.za.
This is usually done via the control panel.
Alternatively, you can have the DNS records updated to the CNAME of the .co.za, as sinbad has said above.
3rd option - message AH support and ask them to configure it. Not sure how good their support is...

AH support is non existant, trust me.You are much better off learning how to do this yourself, as those lot are useless.
 
If you have cpanal, go to redirects and just add the website you want the domain to be redirected to.

For instance

Go to the cpanal account of the .com domain and then select redirect and then enter the .co.za address
 
A far easier way is to just point both domains at the same ip address, setup the virtual hosts for both domain names, and then use a .htaccess rule on Linux, or a web.config rewrite rule in ASP.NET to setup a 301 redirect to the co.za domain. That way if someone tries to go to say http://.com/contactus, they get redirected to http://.co.za/contactus, and likewise for any other sub folders or files that someone tries to access using the .com domain.
 
A far easier way is to just point both domains at the same ip address, setup the virtual hosts for both domain names, and then use a .htaccess rule on Linux, or a web.config rewrite rule in ASP.NET to setup a 301 redirect to the co.za domain. That way if someone tries to go to say http://.com/contactus, they get redirected to http://.co.za/contactus, and likewise for any other sub folders or files that someone tries to access using the .com domain.

Sure one way of doing it, but compared to the build in cpanal option your suggestion is by no means "far easier"... Like not at all.

He's on shared hosting most likely too so there's that...


Just my 2c
 
Easiest solution: if your .com domain has hosting, dump the following in a file called .htaccess in your public_html folder:

Code:
RewriteEngine On
RewriteRule (.*) http://domain.co.za/$1 [R=302,L]

If you want to make domain.com/something redirect to domain.co.za (without the /something), then use this instead:

Code:
RewriteRule ^ http://domain.co.za/ [R=302,L]

If you'd like to treat the redirect as a permanent redirect, you can change 302 to 301.

Note: Creating a redirect using cPanel will do this for you, but it's always good to learn a little .htaccess when you can.
 
Last edited:
Easiest solution: if your .com domain has hosting, dump the following in a file called .htaccess in your public_html folder:

Code:
RewriteEngine On
RewriteRule (.*) http://domain.co.za/$1 [R=302,L]

If you want to make domain.com/something redirect to domain.co.za (without the /something), then use this instead:

Code:
RewriteRule ^ http://domain.co.za/ [R=302,L]

If you'd like to treat the redirect as a permanent redirect, you can change 302 to 301.

Note: Creating a redirect using cPanel will do this for you, but it's always good to learn a little .htaccess when you can.

That's perfect, but just want to confirm, does afrihost shared hosting allow for .htaccess files?

Like I remember editing mine but it got overwritten.

I might be horridy wrong here.
 
That's perfect, but just want to confirm, does afrihost shared hosting allow for .htaccess files?

Like I remember editing mine but it got overwritten.

I might be horridy wrong here.

They do support them - they have to. Something else must have botched up yours. cPanel will make amendments to the file if it exists.
 
They do support them - they have to. Something else must have botched up yours. cPanel will make amendments to the file if it exists.

Cool beans, thanks for the confirmation
 
Top
Sign up to the MyBroadband newsletter
X