I've made a new website for a client who has an intranet integrated into their old website.
The new website is currently on a different server, but when the domain A records point to the new server, the old site (and intranet) will obviously not be accessible, but I need to keep their intranet active. The path to their intranet is: abc.com/intranet
Is there a way to have URL path direct to the old server? For example:
abc.com - new website loads on new server
abc.com/intranet - old website loads on older server
If it's not possible, I suppose I'm looking at creating a sub-domain on abc.com
for the intranet. Any thoughts are appreciated.
Click the URL Redirects tab. In the upper right, click Add URL redirect. In the right panel, select the Standard or Flexible redirect type. A standard redirect is used to redirect one URL to another.
The Web Redirect (WR) record (also known as URL redirect or HTTP forwarding) allows you to redirect the requests for http://yourdomain.com to http://anotherdomain.com. It is a common technique for making a web page available under more than one URL address.
Under Modify a Subdomain, locate the domain you want to redirect, then click its Manage Redirection link on the right. In the text box, type the URL you would like visitors to be redirected to if they go to the subdomain sample1.hgexample.com. Click Save. You will see the redirected URL under the Redirection column.
You need to use an Apache RewriteRule
using mod_rewrite. This can be placed in an .htaccess
file on your server’s root or it can be placed directly into your Apache config file.
If you want to redirect example.com
to example.com/intranet
, then this is the Apache RewriteRule
that should work for your needs:
RewriteEngine on
RewriteRule ^(.*)$ /intranet [L,R=301]
This will grab any URL on the site this RewriteRule
is placed on & redirect them to /intranet
. That /intranet
can also be a full URL such as this example below:
RewriteEngine on
RewriteRule ^(.*)$ http://example.com/intranet [L,R=301]
EDIT: Upon rereading your question, I am not 100% sure the answer above works for you as-is. So I think if you are describing how to point one URL path from one server to another, you would do this. This gets placed on the new server:
RewriteEngine on
RewriteRule ^/intranet(.*)$ http://old_example.com/intranet [L,R=301]
That would grab any URL coming from new_example.com/intranet
and redirect it to old_example.com/intranet
.
ANOTHER EDIT: Since the original poster indicates the server will have the IP fully changed, then a subdomain for the old server is the best way to go. You can’t redirect content on one domain the way you describe if you switch the domains fully to different IP. Both servers need to be active with an active—but different—domain name for what you want to happen.
abc.com/intranet is a path in the virtual file system exposed by your web server, so is not possible to serve the content from different web server. You have 2 options here.
Put a reverse proxy in front of both servers and get the content from server A or B based on the original client request.
As you said, create a subdomain and also redirect /intranet to the new subdomain.
Hope this help!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With