简体   繁体   中英

How can I change the SEF URL to non-SEF URL in Joomla for single view?

I am creating an API type plugin, which fetches activity stream from easysocial. But I got SEF URL in the activity stream, I want the NON-SEF URL in case SEF is on in Joomla configuration.

Please tell me how can I do this, programmatically.

I tried to override the Joomla config setting in my plugins, but it won't work as given below.

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

You would need to make a special .htaccess rule for that

Find this section:

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]

And add this line above it:

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

Where you change the URL to be the nonSEF url you do not want parsed.

I have not verified this. Let me know if it does not work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM