如何.xml扩展名添加到一个特定的URI使用的.htaccess扩展名、xml、htaccess、URI

2023-09-02 10:02:55 作者:Chilly breeze

我有一个网址的时刻www.mydomain.com/feed/my_feed/它写出一个XML文档由第三方读取。 XML文档是动态生成的(我用防爆pressionEngine)。

I have a URL at the moment www.mydomain.com/feed/my_feed/ which writes out an xml document to be read by a third party. The XML document is dynamically generated (I'm using ExpressionEngine).

第三方已要求它必须有一个扩展名为.xml被读取。

The third party have requested that it must have a .xml extension to be read.

任何的想法如何,我可以建立一个htaccess的规则,只能使用.xml文件扩展这个特定URI?

Any ideas how I could set up a .htaccess rule to only use a .xml file extension for this particular uri?

大多数教程所关心的删除文件扩展名添加文件扩展名的所有URL,这不利于中的.htaccess小白。

Most tutorials are concerned with removing file extensions adding file extensions to all urls, which doesn't help a .htaccess noob.

在预先感谢。

推荐答案

我已经使用的.htaccess前重写的.xml掀起了URL的麻烦。通常当我需要做到这一点,我会只使用页面模块,并把 /something/something.xml 作为页面的URI。然后你就可以在任何你想要的模板指向的页面。

I've had trouble using .htaccess to rewrite the .xml off of a URL before. Frequently when I need to do this I'll just use the Pages module and put /something/something.xml as the Pages URI. Then you can point the page at any template you want.