【问题标题】:How can I change the SEF URL to non-SEF URL in Joomla for single view?如何在 Joomla 中将 SEF URL 更改为非 SEF URL 以获得单一视图?
【发布时间】:2015-06-25 22:30:57
【问题描述】:

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

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

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

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

【问题讨论】:

  • 我的回答解决了你的问题吗?如果有,请将其标记为这样,以便搜索此问题的其他人可以看到它。

标签: php joomla sef


【解决方案1】:

您需要为此制定一个特殊的 .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。

我还没有验证这一点。如果它不起作用,请告诉我。

【讨论】:

  • 嗨,有没有其他方法,所以我可以为特定页面或视图更改它。
  • 你可以用上面的方法做到这一点?只需添加更多行。
猜你喜欢
  • 1970-01-01
  • 2010-11-02
  • 2013-03-16
  • 2013-10-15
  • 1970-01-01
  • 2011-02-14
  • 1970-01-01
  • 2013-05-30
  • 1970-01-01
相关资源
最近更新 更多