uzman   03-12-2021 Saat 20:10
#1
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]
İnsan Doğrulama:
Lütfen aşağıda gördüğünüz onay kutusunu işaretleyin. Bu işlem, otomatik spam botlarını önlemek için kullanılır.
İfadeleri İptal Et?
  

Sosyal Ağlarda paylaş


Konuyu Okuyanlar: 1 Ziyaretçi