: 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
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
More posts by @LarsenBagley505
3 Comments
Sorted by latest first Latest Oldest Best
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
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.
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.