Tamam, soru biraz muğlak, bu yüzden cevap da biraz belirsiz görünebilir.
En görselleştirmek yardımcı olmak için bir örnek yapalım. Sen bir gazete web sitesi var, bu yüzden yazı çok hizmet - ama hepsi tek bir dinamik sayfa ...
/articles.do?Article=Important-News-Item
/articles.do?Article=Cash-Strapped-Business-Goes-Into-Administration
Ve böylece.
Daha sonra bazı ekleyin. Htaccess (mod_rewrite) aşkı siteye ...
/Articles/Important-News-Item/
/Articles/Cash-Strapped-Business-Goes-Into-Administration/
Ve geri articles.do sayfası için bu URI yeniden.
Yani articles.do sayfasında, sen Madde tabloyu sorgulamak ve ilgili sayfaya geri almak için isteği dize (Madde = Değer) kullanın ...
SELECT
Headline,
Content,
Image
FROM
Article
WHERE
RestfulId = 'Important-News-Item'
Ve sonra sayfanın üzerine bu pop.
Ben bu soruya noktası cevapsız ettik bağırmak.
mod_rewrite example
Bu yukarıdaki örneğin mod_rewrite kural, geri articles.do URI huzurlu URI eşler.
RewriteEngine on
RewriteRule ^Articles/([^/\.]+)/?$ articles.do?Article=$1 [L,NC,QSA]
Bu (bu açıklamaya değil teknik yolu) açıklamak için en kolay yoludur:
1) The first bit (^Articles/) looks for any address that starts with "Articles/"
2) The second bit (([^/.]+)/) represents "Whatever comes between the "/" after Articles and the next "/" after that, which in this example is the title of the article.
Sen "([^ /.] +) /" Daha ekleyerek segmentleri sonuna kadar daha fazla parametre yakalayabilir ...
RewriteEngine on
RewriteRule ^Articles/([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ articles.do?Article=$1&$2=$3 [L,NC,QSA]
Bu örnekte dönüştürmek olabilir
/Articles/Important-News-Item/My-Key/My-Value/
içine
articles.do?Article=Important-News-Item&My-Key=My-Value