禁止直接访问INI和XML文件


10

一些网站所有者不希望人们(尤其是竞争对手)知道他们网站上的功能。

因为某些语言或配置文件中的敏感信息可以直接从浏览器访问,例如。

administrator/components/com_bank/language/en-GB/en-GB.com_bank.ini
administrator/components/com_bank/config.xml
components/com_bank/models/forms/transaction.xml

尽管只有了解Joomla的技术人员才能找到这些链接,进行访问并找出(或猜测)网站的功能,但是网站所有者希望所有内容都保密。

那么,是否有任何服务器端解决方案或任何Joomla扩展禁止直接访问这些INI和XML文件?

Answers:



6

您可以使用RewriteRule扩展Joomla的.htaccess文件,以获取那里的文件类型。

一个简单的可能是

RewriteRule \.xml$ index.php [L]
RewriteRule \.ini$ index.php [L]

这些规则检查请求的结尾是“ .xml”还是“ .ini”,并将请求重写为index.php。[L]表示最后一条规则。

你应该把它放在

## Begin - Custom redirects

我尝试了这个,结果是我的主页没有加载CSS样式。
— Hung Tran 2014年

您的CSS文件是否以xml或ini结尾?
— Harald Leithner 2014年

它们不是,其扩展名为.css。我使用全新的Joomla安装进行了测试。
— Hung Tran 2014年

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.