1

我正在创建一个 API 类型插件,它从 easysocial 获取活动流。但是我在活动流中获得了 SEF URL,我想要 NON-SEF URL,以防 SEF 在 Joomla 配置中打开。

请告诉我如何以编程方式执行此操作。

我试图覆盖我的插件中的 Joomla 配置设置,但它不会像下面给出的那样工作。

$config = JFactory::getConfig();
$sef = $config->set('sef', 0);
4

1 回答 1

0

您需要为此制定一个特殊的 .htaccess 规则

找到这个部分:

RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]

并在其上方添加这一行:

RewriteCond %{REQUEST_URI} !^/index\.php?option=com_something&var=something

您将 URL 更改为您不想解析的非 SEF url 的位置。

我没有验证这一点。让我知道它是否不起作用。

于 2015-06-25T13:55:44.443 回答