2017-01-05 23 views
0

我最近將站點從HTTP遷移到HTTPS。 我調整了所有的代碼,除了站點地圖,一切正常。HTTP到HTTPS:XSL中的站點地圖返回空白頁面

文件sitemap.php應通過XSL文件返回一個風格化的URL列表。

在HTTP中一切正常......但移動到HTTPS時,它返回Chrome中的空白頁面,並在IE中返回一個沒有風格化的頁面。

我適應的URL到XSL文件到PHP,從HTTPHTTPS以及 但返回的頁面還是空白

在這裏下面所附的截屏,開發商的結果在Chrome 工具enter image description here

請這裏的URL www.liciafox.net/sitemap.php

正如我所說的,THI ■當我更改了協議從HTTPHTTPS

我非常感謝你提前任何建議頂部wroking /幫助

回答

0

我想我找到了一個解決方案。有用。但是我不知道這是否是正確的方法。

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文件中標題的相似方法。 這裏下面的一個沒有工作:

<?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"> 

這裏的工作之一,其中呼叫HTTPS是隻在標籤下面<html>

<?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"> 
0

添加下列頭在sitemap.php

header("Content-type: application/xslt+xml"); 
+0

如果我再補充一點頭,的內容文件不可視化,但作爲文件下載。 與當前標題:標題(「Content-type:application/xml; charset = utf-8」);它作爲網頁管理 –