Php 如何在Joomla中将SEF URL更改为单视图的非SEF URL?
我正在创建一个API类型的插件,它从easysocial获取活动流。 但是我在活动流中得到了SEF URL,我想要非SEF URL,以防SEF在Joomla配置中启用 请告诉我如何通过编程实现这一点 我试图覆盖我的插件中的Joomla配置设置,但它不会像下面给出的那样工作Php 如何在Joomla中将SEF URL更改为单视图的非SEF URL?,php,joomla,sef,Php,Joomla,Sef,我正在创建一个API类型的插件,它从easysocial获取活动流。 但是我在活动流中得到了SEF URL,我想要非SEF URL,以防SEF在Joomla配置中启用 请告诉我如何通过编程实现这一点 我试图覆盖我的插件中的Joomla配置设置,但它不会像下面给出的那样工作 $config = JFactory::getConfig(); $sef = $config->set('sef', 0); 您需要为此制定一个特殊的.htaccess规则 查找此部分: RewriteCond %{
$config = JFactory::getConfig();
$sef = $config->set('sef', 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更改为不希望解析的非有效URL
我还没有证实这一点。如果它不起作用,请告诉我。您需要为此制定一个特殊的.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更改为不希望解析的非有效URL
我还没有证实这一点。如果不起作用,请告诉我。我的回答解决了您的问题吗?如果有,请将其标记为这样,以便搜索此问题的其他人可以看到。我的答案解决了您的问题吗?如果有,请将其标记为这样,以便搜索此问题的其他人可以看到它。您好,是否有其他方法,以便我可以将其更改为特定页面或视图。您可以使用上述方法进行更改?只需添加更多行。嗨,有没有其他方法,这样我就可以为特定的页面或视图更改它。你可以用上面的方法来做吗?只需添加更多行。