- Posts: 4
Other Plugins
Joomdle creating incorrect links after SEF sh404sef install
- drparagsm
- Topic Author
- Offline
- New Member
-
Less
More
10 years 3 months ago - 10 years 3 months ago #1
by drparagsm
Joomdle creating incorrect links after SEF sh404sef install was created by drparagsm
I recently installed SEF plugin sh404sef and activated the Joomla SEF. Enrol course link is now giving Not Found error.
After clicking on enrol course button, this link opens (Not Found Page)
www.xyz.com/elearning/abcd/index.php?opt...sk=enrol&course_id=3
Actually it should be:
www.xyz.com/index.php?option=com_joomdle&task=enrol&course_id=3
The "elearning/abcd" menu items are added before index.php
The "sh404sef" support has following to say:
Your com_joomdle is creating incorrect links:
- they have space before the index.php (that should not be a real problem)
- these are relative links: those links have not been sent to Joomla to be transformed into a SEF URL.
A non-sef URL such as index.php?option=com_joomdle&task=enrol&course_id=3 can only work on the home page. On other pages, it must be rendered absolute, for instance by simply adding a "/" at the beginning.
The actual correct way to do this is to send the URL through the Joomla JRoute::_() method.
Most likely reason for this is that Joomla accepts this kind of wrong URLs, instead of triggering a 404. That's a big SEO issue with Joomla, and maybe it will be fixed one day, but for now it is causing big SEO damages, and sh404SEF is there to fix SEO, so we trigger a 404.
The Joomdle extension creator can talk to me if needed, to solve this issue, but the rule is fairly simple: any URL output to the site must go through JRoute::_().
My question is:
How to render the Joomdle links absolute, either by simply adding a "/" at the beginning or
by using the actual correct way by sending the URL through the Joomla JRoute::_() method ?
I am using the latest Joomdle version and Joomla 3.4.6
After clicking on enrol course button, this link opens (Not Found Page)
www.xyz.com/elearning/abcd/index.php?opt...sk=enrol&course_id=3
Actually it should be:
www.xyz.com/index.php?option=com_joomdle&task=enrol&course_id=3
The "elearning/abcd" menu items are added before index.php
The "sh404sef" support has following to say:
Your com_joomdle is creating incorrect links:
- they have space before the index.php (that should not be a real problem)
- these are relative links: those links have not been sent to Joomla to be transformed into a SEF URL.
A non-sef URL such as index.php?option=com_joomdle&task=enrol&course_id=3 can only work on the home page. On other pages, it must be rendered absolute, for instance by simply adding a "/" at the beginning.
The actual correct way to do this is to send the URL through the Joomla JRoute::_() method.
Most likely reason for this is that Joomla accepts this kind of wrong URLs, instead of triggering a 404. That's a big SEO issue with Joomla, and maybe it will be fixed one day, but for now it is causing big SEO damages, and sh404SEF is there to fix SEO, so we trigger a 404.
The Joomdle extension creator can talk to me if needed, to solve this issue, but the rule is fairly simple: any URL output to the site must go through JRoute::_().
My question is:
How to render the Joomdle links absolute, either by simply adding a "/" at the beginning or
by using the actual correct way by sending the URL through the Joomla JRoute::_() method ?
I am using the latest Joomdle version and Joomla 3.4.6
Last edit: 10 years 3 months ago by drparagsm.
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7936
10 years 3 months ago #2
by Antonio Durán
Replied by Antonio Durán on topic Joomdle creating incorrect links after SEF sh404sef install
Hi.
Thanks the info. I will take a look at it and get back to you as soon as possible.
Thanks the info. I will take a look at it and get back to you as soon as possible.
Please Log in or Create an account to join the conversation.
- drparagsm
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 4
10 years 3 months ago #3
by drparagsm
Replied by drparagsm on topic Joomdle creating incorrect links after SEF sh404sef install
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7936
10 years 3 months ago #4
by Antonio Durán
Replied by Antonio Durán on topic Joomdle creating incorrect links after SEF sh404sef install
Thanks for the info.
This link is built in: administrator/components/com_joomdle/helpers/system.php
Function: actionbutton ()
You will need to check this part:
As you say, we are incorrectly adding spaces to URL.
Please test and let us know what you get.
This link is built in: administrator/components/com_joomdle/helpers/system.php
Function: actionbutton ()
You will need to check this part:
Code:
else if ($free_courses_button == 'enrol') {
if (!$button_text)
$button_text = JText::_('COM_JOOMDLE_ENROL_INTO_COURSE');
$url = ("index.php?option=com_joomdle&task=enrol&course_id=$course_id");
$can_enrol = $course_info['self_enrolment'] && $course_info['in_enrol_date'];
if ( $can_enrol){
$html .= '<FORM>
<INPUT TYPE="BUTTON" VALUE=" '. $button_text.' "
ONCLICK="window.location.href=\' '.$url.' \'">
</FORM>';
}
As you say, we are incorrectly adding spaces to URL.
Please test and let us know what you get.
Please Log in or Create an account to join the conversation.
- drparagsm
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 4
10 years 3 months ago #5
by drparagsm
Replied by drparagsm on topic Joomdle creating incorrect links after SEF sh404sef install
Thanks Antonio,
In file: administrator/components/com_joomdle/helpers/system.php
After adding a "/" before index.php.....the enrol course button is linking fine.
Before: $url = ("index.php?option=com_joomdle&task=enrol&course_id=$course_id"); [ERROR]
After: $url = ("/index.php?option=com_joomdle&task=enrol&course_id=$course_id"); [FINE]
Will I get similar errors in other links?
I am yet to test many other links (mainly paid courses) thoroughly. Go to course and Buy course buttons and text links are fine.
In file: administrator/components/com_joomdle/helpers/system.php
After adding a "/" before index.php.....the enrol course button is linking fine.
Before: $url = ("index.php?option=com_joomdle&task=enrol&course_id=$course_id"); [ERROR]
After: $url = ("/index.php?option=com_joomdle&task=enrol&course_id=$course_id"); [FINE]
Will I get similar errors in other links?
I am yet to test many other links (mainly paid courses) thoroughly. Go to course and Buy course buttons and text links are fine.
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7936
10 years 3 months ago #6
by Antonio Durán
Replied by Antonio Durán on topic Joomdle creating incorrect links after SEF sh404sef install
Hi.
While that change may fix it for you, it will fail if you don't have Joomla on site root (I just confirmed it in my local copy, which is in a folder)
Please try this instead:
- Remove spaces, so that it looks like:
ONCLICK="window.location.href=\''.$url.'\'">
- Use JRoute::_ as you suggested:
$url = JRoute::_("index.php?option=com_joomdle&task=enrol&course_id=$course_id");
As for other links: I have no idea. They work fine without sh404sef, and I don't know many people use that component, so we have not seen many problems. You can test and let us know if you find any errors.
I remeber one user used it, but he just disabled it for joomdle: www.joomdle.com/forum/tips-tricks/3517-wrapper-default-page
While that change may fix it for you, it will fail if you don't have Joomla on site root (I just confirmed it in my local copy, which is in a folder)
Please try this instead:
- Remove spaces, so that it looks like:
ONCLICK="window.location.href=\''.$url.'\'">
- Use JRoute::_ as you suggested:
$url = JRoute::_("index.php?option=com_joomdle&task=enrol&course_id=$course_id");
As for other links: I have no idea. They work fine without sh404sef, and I don't know many people use that component, so we have not seen many problems. You can test and let us know if you find any errors.
I remeber one user used it, but he just disabled it for joomdle: www.joomdle.com/forum/tips-tricks/3517-wrapper-default-page
Please Log in or Create an account to join the conversation.
- drparagsm
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 4
10 years 3 months ago #7
by drparagsm
Replied by drparagsm on topic Joomdle creating incorrect links after SEF sh404sef install
Thanks!
I removed spaces and changed to:
$url = JRoute::_("index.php?option=com_joomdle&task=enrol&course_id=$course_id");
Its working fine.
I removed spaces and changed to:
$url = JRoute::_("index.php?option=com_joomdle&task=enrol&course_id=$course_id");
Its working fine.
Please Log in or Create an account to join the conversation.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7936
10 years 3 months ago #8
by Antonio Durán
Replied by Antonio Durán on topic Joomdle creating incorrect links after SEF sh404sef install
Thanks for the info, I will include the fix for next release.
If you find any other links that give you problems, please let us know.
If you find any other links that give you problems, please let us know.
Please Log in or Create an account to join the conversation.