2009-10-12 19 views

回答

7

您可以告訴服務器發送特定媒體類型的特定文件。

阿帕奇有AddTypeForceType指令要做到這一點:

# send all .atom files with application/atom+xml 
AddType application/atom+xml .atom 

# send only foo.bar as application/atom+xml 
<FilesMatch ^foo\.bar$> 
    ForceType application/atom+xml 
</FilesMatch> 

您可以使用<Directory><DirectoryMatch><Files><FilesMatch><Location><LocationMatch>部分限制指令只對特定目錄,文件或URL路徑。但請注意context它們是允許的。只有<Files><FilesMatch>可用於.htaccess文件。

0

如果你的RSS/ATOM源具有特定擴展名,或者是從一個特定的dorectory服務,我想你可以使用Apache的AddType directive,以便Apache將成爲與正確的內容類型的RSS提要:

AddType指令將給定的 文件擴展名映射到指定的 內容類型上。 MIME類型是用於包含 擴展名的文件名的MIME 類型。


沒有測試,但我想這樣的事情,無論是在你的Apache的主配置文件,或者在.htaccess文件,可能會做,爲RSS提要:

AddType application/rss+xml .rss 

而且,對於ATOM ,可能是這樣的:

AddType application/atom+xml .atom 
相關問題