Asp.net ile 301 Yönlendirme Yapma
22 Temmuz 2019 / 17:50
Burak
Merhaba arkadaşlar,
Kimi zaman sayfaların linklerini değiştirme ve 301 yönlendirme yapmak zorunda kalabiliyoruz.İşte böyle durumlarda aşağıdaki kod parçacığını kullanarak 301 yönlendirme yapabilirsiniz.
Asp.net
1 2 3 4 5 |
Response.Clear(); Response.Status = "301 Moved Permanently"; Response.StatusCode = 301; Response.AddHeader("Location", "yeniurl.aspx"); Response.End(); |
Klasik Asp
1 2 |
Response.Status="301 Moved Permanently"; Response.AddHeader("Location","yeni_sayfa.asp"); |
Web.Config
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="redirectDomain" stopProcessing="true"> <match url="(.*)" /> <action type="Redirect" url="https://www.yenidomain.com/{R:1}" redirectType="Permanent" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern="^(www.)?eskidomain\.com$" /> </conditions> </rule> </rules> </rewrite> </system.webServer> </configuration> |
Eğer yukardakilerden hiç birine yetkiniz yok sadece html destekli bir sayfanız varsa aşağıdaki html kodu kullanarak html yönlendirme yapabilirsiniz fakat bu 301 yönlendirme olur
1 |
<meta http-equiv="refresh" content="10;URL=yonlendirilecek_sayfa.html"/> |
Etiketler: asp 301 yönlendirme, asp.net 301, asp.net 301 redirect, asp.net 301 yönlendirme, asp.net yönlendirme, html sayfa yönlendirme, html yönlendirme kodu, web.config 301 redirect, web.config all pages redirect 301, webconfig 301 yönlendirme
Bu Yazılarıda Okuyabilirsiniz...
Bir cevap yazın