Author Topic: How to get sh404SEF working with SobiSEF  (Read 47155 times)

0 Members and 1 Guest are viewing this topic.

Offline neo

  • Sobi Team
  • Development
  • Sobi Hero
  • *
  • Posts: 8088
  • Reviews:

    What is it?

    • Sobi Team Member
How to get sh404SEF working with SobiSEF
« on: 13. March 2009, 22:38:40 »
Update by aboututila 18-Dec-2010
abbiee reports here http://www.sigsiu.net/forum/community-board-for-troubleshooting-problems/the-mystery-of-the-disappearing-page-title/msg93056/#msg93056 that she has
sh404SEF version 2.1.8.777
successfully working with
SOBI2 2.9.3.2 and SobiSEF plugin RC 1.7 and Joomla! 1.5.22
on several web sites.

Update by aboututila 28-May-2010
According to this post, http://dev.anything-digital.com/Forum/?topic=6159.msg24613#msg24613 in the sh404SEF forums, sh404SEF supports native Joomla! router.php files. Unfortunately, the post does not specify which version(s) of sh404SEF have this support.
I suspect at least Version 1.5.3 Build 296 is needed (Refer http://dev.anything-digital.com/sh404SEF/changelog.html)
Therefore it should be possible to configure sh404SEF 1.5.x to support the SobiSEF plugin (which is a native Joomla! router.php file for the SOBI2 Component).

Update by aboututila 21-Apr-2010
Please Note all statements made by Trinity and Neo in this topic are only valid for the free versions of the sh404SEF Component, the last of which, I think, is Version 1.0.20 (build 237) dated 8-Jun-2008.

Hi guys,

I just installed the latest version of sh404SEF and did some investigations. I noticed basically two problems:

  • Since the latest version, sh404SEF tries to create the SEF URLs for page navigation always by itself. That means, it does not ask anymore the component's plugin how the URL for the page navigation should be created. Unfortunately sh404SEF assumes that all navigation links are created in the same way in each component. But this is not always the case. SOBI2 navigations links does not contain the 'limit' variable and therefore sh404SEF cannot create these links correctly. Because our function has been levered by sh404SEF, the SobiSEF plugin has no chance to create the right SEF URLs and the navigation does not work.
  • The second problem is that sh404SEF tries to create SEF links for each URL. If some non-SEF URL has been called, sh404SEF creates at first a new SEF link and then redirects the visitor to the new created URL. In my honest opinion this simply does not always make sense. SOBI2 uses Ajax for the search function. That means, that a special URL will be called in background (not visible for the visitor) . This URL can look like this:

    index2.php?sobi2Search=term&searchphrase=any&option=com_sobi2&Itemid=53&no_html=1&sobi2Task=axSearch&sobiCid=3&SobiSearchPage=0&SobiCatSelected_0=3&field_postcode=3456&field_city=Berlin&field_county=DE&field_federal_state=Hessen&field_country=Germany

    Nearly each time, if someone searches for something, this URL can look completely different.
    sh404SEF creates each time if someone uses the search function a new SEF URL which looks similar to this:

    /index.php/dir/axsearch/sobicatselected_0/3/sobisearchpage/field_city/berlin/field_country/germany/field_county/de/field_federal_state/hessen/field_postcode/3456/index2_phpsobi2search/term/searchphrase/any/sobicid/3.html

    This means, if you have about 100 visitors daily using the search function for example, about 100 new SEF URLs are created and stored in the database each day.
    Besides them (and this is the main problem) the database field for URLs in sh404SEF database table is limited to 255 characters, but because the SOBI2 search functionality has many adjustable parameters, both addresses (Non-SEF and SEF) are longer than 255 characters and sh404SEF is not able to decode the just created SEF URL.  For example the URL above is stored in the database like this:

    index.php?option=com_sobi2&Itemid=53&SobiCatSelected_0=3&SobiSearchPage=0&field_city=Berlin&field_country=Germany&field_county=DE&field_federal_state=Hessen&field_postcode=3456&index2_phpsobi2Search=term&lang=en&no_html=1&searchphrase=any&sobi2Task=axSear

Solution for the search function:
Solution for the search function and other URLs which should not be translated to a SEF URL:

Edit the file JOOMLA_ROOT/plugins/system/shsef.php about the line 241 change the code:


Code: [Select]
function _parseSefRoute(&$uri)
  {
    $vars   = array();
    include(JPATH_ROOT.DS.'components'.DS.'com_sh404sef'.DS.'sh404sef.php');

to this code:

Code: [Select]
function _parseSefRoute(&$uri)
  {
  $called = $uri->getQuery();
  $exceptions = array( 'delete', 'edit', 'renew', 'save', 'update', 'search' );
  foreach ( $exceptions as $exception ) {
  if( stristr( $called, "task={$exception}" ) ) {
  return $this->_parseRawRoute( $uri );
  }
  }
        if( $uri->getVar( 'no_html', 0 ) ) {
           return $this->_parseRawRoute( $uri );
        }
    $vars   = array();

    include(JPATH_ROOT.DS.'components'.DS.'com_sh404sef'.DS.'sh404sef.php');

Solution for the page navigation ( pagination ) :

Edit the file JOOMLA_ROOT/administrator/components/com_sh404sef/sh404.sef.class .php about the line 3174 change the code:

Code: [Select]
default: {
          $sefstring='';
          $urlType = shGetSefURLFromCacheOrDB($string, $sefstring); // V 1.2.4.t
          if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) && (!empty($limit) || (!isset($limit) && !empty($limitstart)))) {


to this code:


Code: [Select]
default: {
          $sefstring='';
          $urlType = shGetSefURLFromCacheOrDB($string, $sefstring); // V 1.2.4.t
          if (($urlType == sh404SEF_URLTYPE_NONE || $urlType == sh404SEF_URLTYPE_404) &&
               ( isset( $limit ) && $limit && isset( $limitstart ) && $limitstart ) ) {

Don't forget to purge all created SEF URLs in the sh404SEF after these changes.

Hope this helps.

Kind regards,
Neo

EDIT: Updated; fixes for other tasks
« Last Edit: 23. December 2010, 19:44:11 by aboututila »
Support SobiPro - Submit a review on JED
If you want ongoing development for SobiPro and new applications being developed we need your review for SobiPro in the Joomla Extensions Directory.
Thank you very much :w00t:
Country: Germany Germany |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile 

Offline Belaire Technologies

  • Bronze Sponsor
  • Sobi Experte
  • *
  • Posts: 565
  • formerly - yoobuild
  • Reviews:

    What is it?

Re: How to get sh404SEF working with SobiSEF
« Reply #1 on: 14. March 2009, 00:16:20 »
CONTINUED SETUP FROM NEO'S THREAD ABOVE

FOR .HTACESS ONLY

Code: [Select]
########## Begin - Joomla! core SEF Section
############# Use this section if using ONLY Joomla! core SEF
## ALL (RewriteCond) lines in this section are only required if you actually
## have directories named 'content' or 'component' on your server
## If you do not have directories with these names, comment them out.
#
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]       ##optional - see notes##
#RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
#RewriteRule ^(content/|component/) index.php
#
########## End - Joomla! core SEF Section



########## Begin - 3rd Party SEF Section
############# Use this section if you are using a 3rd party (Non Joomla! core) SEF extension - e.g. OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc
#
RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]       ##optional - see notes##
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
#
########## End - 3rd Party SEF Section

SH404SEF SETUP
1.  Change your htaccess.txt to .htaccess (The code above is to show you what you need comment out the joomla SEF and add in the 3rd part SEF if not there)
2.  Turn off all SEO setting in Joomla Configuration.
3.  Install SH404SEF First, then enable "Switch to Extended Display"
4.  Go to the configuration ->advance tab and make sure you have this setting turned on "Rewrite Mode" w/.htaccess (should be on by default)
5.  Then go to the  configuration ->"by component" tab and turn off everything for sobi2.
6.  Set the: 301 redirect from JOOMLA SEF to sh404SEF to YES
7.  Now test your new URLs.  At this point all URLs except sobi should be converting.  You can mess with the settings and customize your URLs as needed.

SOBISEF SETUP
1.  Now it's time to install the sobi2SEF component.  Open up the sobi2 plugin manager and inistall the component.
2.  Set the settings you want and then enable it.
3.  Go back into sh404SEF and to the  configuration ->"by component" tab and enable all sobi2 options.
4.  Set all settings to yes except for: Enable Debug Mode
5.  Now test your sobi2 URLs.


JOOMLA SETUP (WHEN SYSTEM CACHE TURNED ON)
1.  Go into plugins
2.  Move the System-Cache plugin all the way to the bottom for the system items.  Note:  Plugins are ran in order from first to last.


SOBI2 GENERAL CONFIGURATION
1. Go to SOBI configuration --> General Configuration and select the Cache Tab
2. Set 2nd level cache to: NO
3. Set 3rd level chace to: Yes

SOBI SEF TEMPLATE OPTIONS:

In my vcard template I had added some options to my URL and the URLs were not translating quite right.  So here is some advanced features you will have to use if you have sobi2 URLs within your templates.

The item in green is key for SEF SOBI2 translation.  The item in red is extra URL options and I have not found a way to translate this yet.

/*********TEMPLATE SEF TRANSLATION************/
      $mySobi = new sobi2( $id );
      $config =& sobi2Config::getInstance();
      $pluginsObjects  =& $config->S2_plugins;
      $catid = (int) sobi2Config::request($_REQUEST, 'catid', 0);
      $link = sobi2Config::sef("index.php?option=com_sobi2&sobi2Task=sobi2Details&catid={$catid}&sobi2Id={$id}&Itemid={$config->sobi2Itemid}&tmpl=sobi2_data");

           echo "<p class='sobi2ItemTitle'><a title=\"$mySobi->title\" $rel href=$link>$mySobi->title</a></p>";
/*********TEMPLATE SEF TRANSLATION************/


KNOWN ISSUES-FIXES
1.  There is a "details" tag in my URL - This is cause by not installing SH404SEF first and the sobiSEF second.  If you reload SH404SEF then you need to also reinstall sobiSEF as well.
« Last Edit: 27. March 2009, 15:20:48 by yoobuild »
No one answering your sobi2 questions? Try our secondary support @ belairetech.com.  Sign in an open a ticket.  Sorry no large development questions please.  For now the service is free to sobi2 members.
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile Belaire Technologies

Do you want continued ongoing development, new features and active support?
Please write a review or just vote for SOBI on JED.

Offline Belaire Technologies

  • Bronze Sponsor
  • Sobi Experte
  • *
  • Posts: 565
  • formerly - yoobuild
  • Reviews:

    What is it?

Re: How to get sh404SEF working with SobiSEF
« Reply #2 on: 14. March 2009, 00:40:15 »
BOTH WORK PERFECT!

Thanks again!
No one answering your sobi2 questions? Try our secondary support @ belairetech.com.  Sign in an open a ticket.  Sorry no large development questions please.  For now the service is free to sobi2 members.
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile Belaire Technologies

Offline Creatorffm

  • Sobi Newbie
  • *
  • Posts: 14
  • I've tried everything, nothing works!
  • Reviews:

    What is it?

Re: How to get sh404SEF working with SobiSEF
« Reply #3 on: 14. March 2009, 01:36:57 »
WOW!!!  :silly: :-\ WORKS LIKE A DREAM! THANKS NEO!  :w00t:
Dave "Creator" Marshall
Country: Germany Germany |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile Parents Helping Parents

Offline Sean Weigold Ferguson

  • Sobi User
  • **
  • Posts: 43
  • Sean Weigold Ferguson
  • Reviews:

    What is it?

Re: How to get sh404SEF working with SobiSEF
« Reply #4 on: 14. March 2009, 04:51:31 »
Once again, thank you Neo for your commitment to this project.  I truly appreciate your dedication to your users.
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile WellonTop Internet Research

Offline neo

  • Sobi Team
  • Development
  • Sobi Hero
  • *
  • Posts: 8088
  • Reviews:

    What is it?

    • Sobi Team Member
Re: How to get sh404SEF working with SobiSEF
« Reply #5 on: 14. March 2009, 12:37:57 »
Updated; fixes for other tasks
Support SobiPro - Submit a review on JED
If you want ongoing development for SobiPro and new applications being developed we need your review for SobiPro in the Joomla Extensions Directory.
Thank you very much :w00t:
Country: Germany Germany |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile 

Offline smashtheguitar

Re: How to get sh404SEF working with SobiSEF
« Reply #6 on: 14. March 2009, 19:33:58 »
Thanks for the fix, but when I make the second change it kills my site and pops up a big old 500 Error. I cleared out the sh404sef cache and purged the created sef urls, but even my homepage pops up this big old error:

500 -
SH404SEF : headers were already sent when I got control!
Killed at line 148 in sh404sef.php: HEADERS ALREADY SENT (200)
URL=http://xxxxx.com/
OPTION=com_content

Any idea what setting I need to change to fix this?
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline neo

  • Sobi Team
  • Development
  • Sobi Hero
  • *
  • Posts: 8088
  • Reviews:

    What is it?

    • Sobi Team Member
Re: How to get sh404SEF working with SobiSEF
« Reply #7 on: 15. March 2009, 11:15:25 »
Try to change the code in the file components/com_sh404sef/sh404sef.php about the line 141

from:


    
	
	
  unset(
$matches);
    
	
	
  if (!
headers_sent()) {
    
	
	
    
header('HTTP/1.0 200 OK');
    
	
	
  }
    
	
	
  else {
    
	
	
    
$url $GLOBALS['shConfigLiveSite'].$_SERVER['QUERY_STRING'];
    
	
	
    
_log('Headers already sent on homepage');
    
	
	
    
JError::raiseError(500"<br />SH404SEF : headers were already sent when I got control!<br />Killed at line ".__LINE__." in ".basename(__FILE__).": HEADERS ALREADY SENT (200)<br />URL=".@$uri->_uri.'<br />OPTION='.$vars['option'] );
    
	
	
  }
    
	
	
}


to this:


    
	
	
  unset(
$matches);
    
	
	
 if (!
headers_sent($filename$linenum)) {
    
	
	
    
header('HTTP/1.0 200 OK');
    
	
	
  }
    
	
	
  else {
    
	
	
    
$url $GLOBALS['shConfigLiveSite'].$_SERVER['QUERY_STRING'];
    
	
	
    
_log('Headers already sent on homepage');
    
	
	
    
JError::raiseError(500"<br />SH404SEF : headers were already sent in {$filename} at line {$linenum} when I got control!<br />Killed at line ".__LINE__." in ".basename(__FILE__).": HEADERS ALREADY SENT (200)<br />URL=".@$uri->_uri.'<br />OPTION='.$vars['option'] );
    
	
	
  }
    
	
	
}



and post the error message again.

Kind regards,
Neo
 
Support SobiPro - Submit a review on JED
If you want ongoing development for SobiPro and new applications being developed we need your review for SobiPro in the Joomla Extensions Directory.
Thank you very much :w00t:
Country: Germany Germany |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile 

Offline mboumans

Re: How to get sh404SEF working with SobiSEF
« Reply #8 on: 15. March 2009, 22:25:59 »
Works like a charme. I''m sooooooooo pleased with this. Thanks Neo
Country: Netherlands Netherlands |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Offline smashtheguitar

Re: How to get sh404SEF working with SobiSEF
« Reply #9 on: 16. March 2009, 02:26:17 »
Made the new change, and here's the new error message:

500 -
SH404SEF : headers were already sent in /home/politih4/public_html/xxxx/administrator/components/com_sh404sef/sh404sef.class.php at line 7728 when I got control!
Killed at line 336 in sh404sef.php: HEADERS ALREADY SENT (200)
URL=http://xxxx.com/
OPTION=com_content
Country: United States United States |  OS: Unknown Unknown Browser: Unknown Unknown | View Profile

Tags: