We have our IIS sites and DNS settings on AWS, so Route 53 for managing domains. We disabled an old site on our server, and I now need to route any requests for any page on the old site, to the homepage of a new site.
https://www.oldsite.com/* to https://www.newsite.com
The only way we've been able to do this seems to depend on the same URL being on the new site, which is not the case. This is the way it's working now.
https://www.oldsite.com/apage.html to https://www.newsite.com/apage.html
Any way in AWS to make ANY URL request from the old site redirect to JUST the homepage of the new site? Thanks!
CodePudding user response:
The simplest solution is to create an A record for oldsite.com that points to the same address pointed to the same address as newsite.com
If this doesn't work it's because the HTTP server is checking for domain names in HTTP requests (through the 'host' HTTP header)
In order to solve this problem you need to tell your HTTP server that oldsite.com is a valid name for your server. The server was already configured to know that it's name is newsite.com, so you should look for that configuration file and copy the syntax for oldsite.com
Another slightly more maintainable solution is to use a CNAME record, which allows a domain name to resolve to another domain name. In this case the record would point from oldsite.com to newsite.com Browsers will be free to use either oldsite.com or newsite.com as a "host" HTTP header, so make sure to solve the same issue if there's domain name filtering involved in your server configuration.
CodePudding user response:
You could install IIS rewrite module and use the redirect 401 to let the SEO knows this is permanent redirect.
And here is the code , just append in web.config to setup the rewrite in your old site.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="test" stopProcessing="true">
<match url=".*" />
<action type="Redirect" url="https://www.google.com{PATH_INFO}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
