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

220 views Asked by At

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);
1

There are 1 answers

2
Søren Beck Jensen On

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.