: Creating subdomain(sub.domain.com) and redirecting to another server (sub.domain.org) whiles maintaining .com in the url Redirecting to different server but same domain. I have 2 servers on different
Redirecting to different server but same domain.
I have 2 servers on different hosts. One has domain.com and the other domain.org. domain.org has more resources.
Now i want to create a sub domain on the first one (sub.domain.com) and redirect to (sub.domain.org) whiles maintaining the .com in the urls.
Thanks.
More posts by @Pope3001725
1 Comments
Sorted by latest first Latest Oldest Best
There are only two ways to do this, as far as I know.
To "Genuinely" keep the domain the .com, you'll need to set up a Reverse Proxy. In Apache, this is very easy.
NameVirtualHost *:80
<VirtualHost *:80>
ServerName sub.yourdomain.com
ProxyRequests off
#optimally , use some sort of local URL. Saves bandwidth, faster.
ProxyPass / localhost/ ProxyPassReverse / localhost/ #alternatively , use the public URL.
#ProxyPass / domain.org/ #ProxyPassReverse / domain.org/ </VirtualHost>
The second way is with an iFrame:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Full Page IFrame</title>
<style type="text/css">
html {overflow: auto;}
html, body, div, iframe {margin: 0px; padding: 0px; height: 100%; border: none;}
iframe {display: block; width: 100%; border: none; overflow-y: auto; overflow-x: hidden;}
</style>
</head>
<body>
<iframe id="tree" name="tree" src="`http://domain.org`" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"></iframe>
</body>
</html>
Just know that the iFrame would be less forgiving, since Search Engines would see it differently, if SEO matters to you. Another issue is that if you have SSL, it's a totally different ballgame for both iFrames and Apache. And thirdly, if a user has some sort of web filter blocking stuff on the .org, then it will be blocked on the .com.
The Apache proxy is a better solution, in my opinion, because it puts all the content on one page. However, it would be a little slower if they are on two different servers.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.