Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

joomsef mod_rewrite
(1 viewing) (1) Guest
Support forum for users using free edition of JoomSEF 3 (Joomla 1.5 compatible). These forums are mainly for mutual help between users.

Please note that due to our capacity limitations, we do not monitor these forums regularly.
  • Page:
  • 1

TOPIC: joomsef mod_rewrite

joomsef mod_rewrite 14 years, 11 months ago #9510

I'm using joomla artio SEF component on my server, and I needed to create dynamic SEF urls so I used mod_rewrite and wrote something like:

RewriteCond %{REQUEST_URI} ^/mm/.*?/.*?$
RewriteRule ^mm/(.*?)/(.*?)$ index.php?option=com_mindmapufp&view=mindmapufp&name=$2&id=$1&tmpl=component [L]

This will do an internal redirection from an url like /mm/something/something to index.php?option=com_mindmapufp&view=mindmapufp&name=something&id=something&tmpl=component

After debugging, the GET variable "option" gets changed to "com_content" instead of "com_mindmapufp", so I get a 404 error! If I disable joomsef plugin, it works fine...

Any ideas on how to solve it?

Thanks!

Re:joomsef mod_rewrite 14 years, 11 months ago #9512

  • jaku
Hello,

that is a bit strange. Anyway, make sure that JoomSEF handler for com_mindmapufp is set to "skip".

Re:joomsef mod_rewrite 14 years, 11 months ago #9535

Yeah, it's odd... I had already skipped com_mindmapufp on the global configurations...

If I use an external redirect, it works fine. But if I do an internal redirect like I posted, it fails with 404 error because option is changed to com_content.

bug or feature?

Re:joomsef mod_rewrite 14 years, 11 months ago #9547

I debugged the problem and it turns out that when internal redirecting a page through mod_rewrite, QUERY_STRING is updated but REQUEST_URI stays like the old url.

To hotfix the problem I changed components/com_sef/joomsef.php:

 
function parse(&$uri)
{
global $mainframe;
 
// test for the backlink plugin to work correctly
if (JPluginHelper::isEnabled('system', 'backlink')) {
$joomlaRequest = $_SERVER['REQUEST_URI'];
$realRequest = $uri->toString(array('path', 'query'));
 
if ($realRequest != $joomlaRequest) {
$uri = new JURI($joomlaRequest);
}
}
 
+ if (!empty($_SERVER['QUERY_STRING']))
+ {
+ $uri->_query .= (!empty($uri->_query) ? '&' : '').$_SERVER['QUERY_STRING'];
+ }
 


Probably the redirect detection should be made prior to this function and in other parts of the code, but this just worked for me. How can I suggest this to enter the mainstream as a mod_rewrite compatibility fix?

Thanks.
Last Edit: 14 years, 11 months ago by magro. Reason: code update

Re:joomsef mod_rewrite 14 years, 11 months ago #9552

  • jaku
Hello,

thanks for your post. I will point our programmers to your post so we can check it closer.
  • Page:
  • 1
User Login Empty