Şimdi Ara

web.config ile url rewrite

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
1 Misafir - 1 Masaüstü
5 sn
1
Cevap
0
Favori
226
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • Ben web.config ile url rewrite ile seo uyumlu url yapmak istiyorum ama id çakışması sorunu yaşıyorum.

    -------------------------------------------------------
    detay.asp isimli bir sayfam var bu sayfa iki ayrı tablodan veri çekiyor.

    BİRİNCİ TABLO:haber
    İKİNCİ TABLO: konu

    bu sayfaya iki değişik yolla ulaşılabiliyor.

    1-www.xyz.com/detay.asp?Hid=123
    2-www.xyz.com/detay.asp?Kid=123


    sayfa gelen Query String leri bir if ile kontrol ediyorum.


    <%
    if Request.QueryString("Hid") then

    'haber tablosundan veri çeker

    else if Request.QueryString("Kid") then

    'konu tablosundan veri çeker

    end if
    %>


    ---------------------------------------------------

    kullandığım linkler aşağıdaki şekle çevirdim:

    1-www.xyz.com/detay.asp?Hid=123
    1-<a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=129709337&url=www.xyz.com/haber/123" data-href="www.xyz.com/haber/123"> Haberi Oku </a>

    2-www.xyz.com/detay.asp?Kid=123
    2-<a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=129709337&url=www.xyz.com/konu/123" data-href="www.xyz.com/konu/123"> Konuyu Oku </a>

    ---------------------------------------------------

    web.config dosyasının içeriğini şöyle ayarladım


    <configuration
    <system.webServer>
    <rewrite>
    <rules>

    <rule name="rule 2W" stopProcessing="true">
    <match url="^([0-9a-zA-Z-_]+)/([0-9]+)$" />
    <action type="Rewrite" url="/Test2.php?sef={R:1}&amp;HKey={R:2}" appendQueryString="true" />
    </rule>

    <rule name="rule 3W" stopProcessing="true">
    <match url="^([0-9a-zA-Z-_]+)/([0-9]+)$" />
    <action type="Rewrite" url="/Test2.php?sef={R:1}&amp;MKey={R:2}" appendQueryString="true" />
    </rule>

    </rules>
    </rewrite>
    </system.webServer>
    </configuration>



    ---------------------------------------------------------

    çıktı sayfası yani detay.asp de sonuç şöyle çıkıyor


    1-<a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=129709337&url=www.xyz.com/haber/123" data-href="www.xyz.com/haber/123"> Haberi Oku </a> linke tıklandığında
    response.write = "haber id =" & Request.QueryString("Hid") '//// haber id = 123 sonucu sorunsuz çalışıyor.

    2-<a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=129709337&url=www.xyz.com/konu/123" data-href="www.xyz.com/konu/123"> Konuyu Oku </a> linke tıklandığında
    response.write = "Konu id =" & Request.QueryString("Kid") '//// haber id = 123 HATALI ÇIKIYOR STRİNG DE KONU İD GELDĞİ HALDE SAYAFA BUNU HABER İD GELMİŞ GİBİ DAVRANIYOR.

    SONUÇTA İD ÇAKIŞMASI VAR YARDIMCI OLACAK ARKADAŞLARA ŞİMDİDEN TEŞEKKÜRLER.



    < Bu mesaj bu kişi tarafından değiştirildi Policemal -- 3 Kasım 2017; 22:37:25 >







  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.