ForumTeams | Türkiye'nin Forum Topluluğu

Tam Versiyon: PHP Sitemap Oluşturucu
Şu Anda Arşiv Modunu Görüntülemektesiniz. Tam Versiyonu Görüntülemek İçin Buraya Tıklayınız.
SQL Kodlarını kendinize göre düzenleyiniz. Kodlar:

Kod:
require_once('config.ph'); header('Content-Type: text/xml'); echo ' <?xml version="1.0" encoding="UTF-8"?>   <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> '; foreach($dbh->query("SELECT * FROM news WHERE news_status = 1 ORDER BY news_title ASC") as $dataRow){ echo ' <url><loc>https://yoursite.com/post/'.$dataRow['news_seo'].'</loc></url> <changefreq></changefreq> <lastmod>'.date("Y-m-d", strtotime($dataRow['news_date'])).'</lastmod> <changefreq>weekly</changefreq> <priority>0.5</priority>'; } echo '</urlset>';

HTAccess dosyasına aşağıdaki kodu ekleyiniz:

Kod:
RewriteRule ^sitemap.xml$ sitemap.php [L, NC, QSA]