Redirecting a site to asp.net

I have a website consisting of some .asp file and a lot of static .html

I want to redirect everything

www.example.old / abc.html

www.example.old / xyz.html

to

www.example.new/abc.html

www.exaple.new/xyz.html

If I'm on Apache, I would use .htaccess, but how could I do this on an ASP, ASP.NET server? (I do not have access to IIS Manager)

.NET Fw: 3.5 OS: Windows 2003 IIS: 6.0

+3
source share
3 answers

You can do it with global.asax

If this is a permanent redirect, you will want to use a redirect of 301 rather than 302 to allow search engine crawlers to update their links.

Response.Clear();
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.example.new/abc.html");
Response.End();

: , html ASP.NET ISAPI, IIS, , .

ASP global.asax - global.asa

HTML , , meta refresh.

+1

web.config:

<rule name="Redirect Rule" stopProcessing="true"> 
<match url=".*/(.*)" />
<action type="Redirect" url="www.example.new/{R:1}" redirectType="Permanent" /> 
</rule>
+3

ASP... global.asa... , .asp .

ASP.NET, global.asax, Session_Start, .

html-, ASP ASP.NET, html-, meta refresh .

If you have access to IIS, you can modify the 404.htm file that it uses. Add the update meta tag there so that all other requests are sent to your site.

0
source

Source: https://habr.com/ru/post/1754239/


All Articles