に次のヘッダーを追加します。
私は解決策を見つけたと思う。できます。しかし、これが正しい方法かどうかはわかりません。 sitemap.php
// Header forming
header("Content-type: application/xml; charset=utf-8");
echo "<?xml version='1.0' encoding='UTF-8'?>" . "\n";
echo "<?xml-stylesheet type='text/xsl' href='https://{$url}/sitemap.xsl'?>" . "\n";
echo '<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"' . "\n";
echo ' xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"' . "\n";
echo ' xsi:schemaLocation="https://www.sitemaps.org/schemas/sitemap/0.9 https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' ."\n";
上
次の行では、外部サイトへのHTTPS呼び出しを含めることはできません。しかし、それはHTTPだけでなければなりません(私のサイトへの呼び出しを除いて)
// Header forming
header("Content-type: application/xml; charset=utf-8");
echo "<?xml version='1.0' encoding='UTF-8'?>" . "\n";
echo "<?xml-stylesheet type='text/xsl' href='https://{$url}/sitemap.xsl'?>" . "\n";
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' . "\n";
echo ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
echo ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' ."\n";
XSLファイルのヘッダーと同様の方法です。ここに1つ下の は動作しませんでした:
コールHTTPSのみタグ
<html>
上にある作業1、以下ここ
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:html="https://www.w3.org/TR/REC-html40"
xmlns:sitemap="https://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsl="https://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="https://www.w3.org/1999/xhtml">
:私はそのヘッダを追加した場合、
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="https://www.w3.org/1999/xhtml">
の内容ファイルは可視化されず、ファイルとしてダウンロードされます。 現在のヘッダーでは:header( "Content-type:application/xml; charset = utf-8");それはWebページとして管理しています –