
Google me detecta el sitemap como HTML
Publicado por JetLagFox (19 intervenciones) el 17/06/2017 14:06:39
Buenas,
Estoy teniendo un problema con el sitemap de mi web. Lo genero de forma dinámica debido a que el contenido cambia a diario, con lo que lo creo con PHP de la siguiente forma:
El fichero se crea bien. En htaccess he añadido la siguiente línea:
Y en robots.txt el siguiente:
Sin embargo al enviar el sitemap a Google me aparece un error y me lo detecta como HTML, con lo que no se está enviando ninguna URL...
¿Cómo puedo solucionar éste problema? No entiendo cómo me da ese error si como veis aquí el sitemap lo genera perfectamente:
http://www.laxtore.com/sitemap.php
Estoy teniendo un problema con el sitemap de mi web. Lo genero de forma dinámica debido a que el contenido cambia a diario, con lo que lo creo con PHP de la siguiente forma:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
header("Content-type: text/xml");
echo "<?xml version='1.0' encoding='UTF-8'?>";
echo "<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'
xmlns:news='http://www.google.com/schemas/sitemap-news/0.9'>";
require 'admin/config.php';
require 'funciones.php';
try {
$conexion = new PDO($bd_config['dbname'], $bd_config['usuario'], $bd_config['password'] );
} catch (PDOException $e) {
header ('Location: error.php');
echo "ERROR: ".$e->getMessage();
die();
}
$hoy = getdate();
$mes = $hoy['mon'];
$dia = $hoy['mday'];
if ($hoy['mon'] < 10) {
$mes = "0" . $mes;
}
if ($hoy['mday'] < 10) {
$dia = "0" . $dia;
}
$fecha_hoy = $hoy['year'] . "-" . $mes . "-" . $dia;
echo "<url>\n";
echo "<loc>http://www.laxtore.com/</loc>\n";
echo "<lastmod>" . $fecha_hoy . "</lastmod>\n";
echo "<changefreq>daily</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Indice-Precios/</loc>\n";
echo "<lastmod>" . $fecha_hoy . "</lastmod>\n";
echo "<changefreq>daily</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
echo "<url>\n";
echo "<loc>http://www.laxtore.com/contacto/</loc>\n";
echo "<priority>0.8</priority>\n";
echo "</url>\n";
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Xbox-One/</loc>\n";
echo "<lastmod>" . $fecha_hoy . "</lastmod>\n";
echo "<changefreq>daily</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
$statement = $conexion->prepare("SELECT * FROM retrocompatibles_360 ORDER BY Agregado DESC");
$statement->execute();
$ultimo_juego_360 = $statement->fetchAll();
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Xbox-360/</loc>\n";
echo "<lastmod>" . substr($ultimo_juego_360[0]['Agregado'],0,10) . "</lastmod>\n";
echo "<changefreq>daily</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
$statement = $conexion->prepare("SELECT * FROM retrocompatibles_360 WHERE retro = 1 ORDER BY Agregado DESC");
$statement->execute();
$ultimo_juego_360_retro = $statement->fetchAll();
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Xbox-One/retrocompatibles/</loc>\n";
echo "<lastmod>" . substr($ultimo_juego_360_retro[0]['Agregado'],0,10) . "</lastmod>\n";
echo "<changefreq>monthly</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Deals-With-Gold/</loc>\n";
echo "<changefreq>weekly</changefreq>\n";
echo "<priority>1</priority>\n";
echo "</url>\n";
$statement = $conexion->prepare("SELECT * FROM art ORDER BY fecha_publicacion");
$statement->execute();
$articulos = $statement->fetchAll();
foreach ($articulos as $articulo) {
echo "<url>\n";
echo "<loc>http://www.laXtore.com/noticia/" . $articulo['ID'] . "/" . limpia_url($articulo['titulo']) . "/</loc>\n";
echo "<news:news>\n";
echo "<news:publication>\n";
echo "<news:name>LaXtore</news:name>\n";
echo "<news:language>es</news:language>\n";
echo "</news:publication>\n";
echo "<news:genres>Tecnología, Xbox One, videojuegos, videogames</news:genres>\n";
echo "<news:publication_date>" . substr($articulo['fecha_publicacion'],0,10) . "</news:publication_date>\n";
echo "<news:title>" . str_replace("&","and",$articulo['titulo']) . "</news:title>\n";
echo "<news:keywords>" . str_replace(",", ";",str_replace("&","and",$articulo['etiquetas'])) . "</news:keywords>\n";
echo "</news:news>\n";
echo "</url>\n";
}
$statement = $conexion->prepare("SELECT * FROM info_XboxOne ORDER BY agregado DESC");
$statement->execute();
while ($xbox_individual = $statement->fetch()) {
echo "<url>\n";
echo "<loc>http://www.laxtore.com/Juegos/Xbox-One/" . $xbox_individual['id'] . "/" . limpia_url($xbox_individual['Juego']) . "/</loc>\n";
echo "<lastmod>" . substr($xbox_individual['agregado'],0,10) . "</lastmod>\n";
echo "<priority>0.8</priority>\n";
echo "</url>\n";
}
echo "</urlset>\n";
?>
El fichero se crea bien. En htaccess he añadido la siguiente línea:
1
RewriteRule ^sitemap\.xml$ sitemap.php [L]
Y en robots.txt el siguiente:
1
Sitemap: http://www.laxtore.com/sitemap.xml
Sin embargo al enviar el sitemap a Google me aparece un error y me lo detecta como HTML, con lo que no se está enviando ninguna URL...
¿Cómo puedo solucionar éste problema? No entiendo cómo me da ese error si como veis aquí el sitemap lo genera perfectamente:
http://www.laxtore.com/sitemap.php
Valora esta pregunta


0