You need to use Apache RewriteRule using mod_rewrite . It can be placed in a .htaccess file on your root server or it can be placed directly in your Apache configuration file.
If you want to redirect example.com to example.com/intranet , then this is Apache RewriteRule , which should work for your needs:
RewriteEngine on RewriteRule ^(.*)$ /intranet [L,R=301]
This will capture any URL on the site that the RewriteRule is RewriteRule , and redirect them to /intranet . This /intranet can also be a full URL, such as this example below:
RewriteEngine on RewriteRule ^(.*)$ http://example.com/intranet [L,R=301]
EDIT:. Rereading my question, I am not 100% sure that the answer above works for you as it is. Therefore, I think that if you describe how to specify one URL from one server to another, you will do it. This installs on the new server:
RewriteEngine on RewriteRule ^/intranet(.*)$ http://old_example.com/intranet [L,R=301]
To capture any URL coming from new_example.com/intranet and redirect it to old_example.com/intranet .
OTHER EDITING:. Since the original poster indicates that the server will completely change the IP address, the subdomain for the old server will be preferable. You cannot redirect content to the same domain as you describe if you completely switch domains to different IP addresses. Both servers must be active with the name of an active, but different domain, for what you want.
source share