Ultima modifica:
Buongiorno,
come da titolo ho un problema con lo script php per generare la sitemap.
Lo script è questo:
crea_sitemap.php
in .htaccess
In allegato lo screen della tabella. Quale potrebbe essere l'errore?
come da titolo ho un problema con lo script php per generare la sitemap.
Lo script è questo:
crea_sitemap.php
Codice:
<?php
$connect = mysqli_connect('hostdb', 'userdb', 'passdb', 'namedb')
$query = "SELECT `url' FROM `tbl_services`";
$result = mysqli_query($connect, $result);
$base_url = "https://insufflaggiopareti.it/";
header("Content-Type: application/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="UTF-8"?>'. PHP_EOL;
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . PHP_EOL;
while($row = mysqli_fetch_array($result)){
echo '<url>' . PHP_EOL;
echo '<loc>'.$base_url. $row["url"] .'/</loc>' . PHP_EOL;
echo '<changefreq>daily</changefreq>' . PHP_EOL;
echo '</url>' . PHP_EOL;
}
echo '</urlset>' . PHP_EOL;
?>
in .htaccess
Codice:
RewriteEngine On
RewriteRule ^sitemap\.xml/?$ sitemap.php
In allegato lo screen della tabella. Quale potrebbe essere l'errore?