Mobile app version of vmapp.org
Login or Join
LarsenBagley505

: How to point domain to different host sub folder i have a host and domain on godaddy, i have a subdomain like : sub1.mydomain.com. Now my friend has another domain like myfrienddomain.com and

@LarsenBagley505

Posted in: #Domains #Map #WebHosting

i have a host and domain on godaddy, i have a subdomain like : sub1.mydomain.com. Now my friend has another domain like myfrienddomain.com and he point to my host.

How can i point his domain to my subfolder sub1. Everytime he open myfrienddomain.com it will show my site on sub1.mydomain.com. Currently he show mine mydomain.com sites.

Is this possible ,please help me!

Sr if there is duplicated post, i search for over 45 page on stackoverflow and 1 post said i should post on this sites

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @LarsenBagley505

3 Comments

Sorted by latest first Latest Oldest Best

 

@Yeniel560

There are 2 real solution ( not the redirecting thing)


Using 'Domain Masking' ( google it)
You want otherdomain.com to show the sub1.maindomain.com/folder


You can do the following .

• create a sub2.maindomain.com
And configure it with the server so that it displays the sub1/folder

• Create a CNAME Record on otherdomain.com that points to sub2.maindomain.com

10% popularity Vote Up Vote Down


 

@Sherry384

The absolute simplest thing to do is create a CNAME record in your DNS that points myfrienddomain.com to sub1.mydomain.com and make sure there is no A record for myfrienddomain.com. You do not need a redirect. Let DNS do the work.

10% popularity Vote Up Vote Down


 

@LarsenBagley505

An easy way to do it in PHP is to create index.php on the site that needs to be redirected:

<?php
header("HTTP/1.1 301 Redirect",true);
header("Location: example.com/folder ,true);
?><html><head><title>Redirect</title></head><body><a href="http://example.com">Click here to continue</a></body></html>


Just replace example.com with the domain you want the redirection to go to.

In your case, make index.php in the document root of the domain:

myfrienddomain.com


Then make your index.php contain the following:

<?php
header("HTTP/1.1 301 Redirect",true);
header("Location: sub1.mydomain.com ,true);
?><html><head><title>Redirect</title></head><body><a href="http://sub1.mydomain.com">Click here to continue</a></body></html>


sub1 is a subdomain here.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme