Topic-icon Sweepstakes Workflow with Facebook Auth Dialog Box?

Active Subscriptions:

None
Thanks for the great ideas Alex! I'm using SH404 for URL rewrites. I turned the component off and the redirect seems to work properly. Rearranging the JFBCSystem plugin didn't help with the redirect loop. I looked through SH404 settings and the component was set to leave JFBC as non-SEF. After sifting through the options a little more, I think I found the culprit: SH404 was set to 301 redirect non-SEF URLs to SEF URLs. After turning this feature off, the redirect seems to work like we wanted it to.

Its a little strange, as I thought this server side code wouldn't be affected by this, but the redirect code now works. I only use SEF URLs on the front end, so I don't think this will cause any SEO issues. Do you know of any concerns or negative impacts from turning this functionality off?
The topic has been locked.
Active Subscriptions:

None
Well, this code almost solved all the redirect problems. :)

Turns out there is some other content in the workflow that needs to be excluded from the redirect IF statement (otherwise they get redirected). In total, three pieces of content that need to be excluded, all from com_content. I've tried several different approaches, but I can't seem to get it right. Here's the last thing I tried...
if ($result && ((JRequest::getCmd('option') != 'com_content') || (JRequest::getCmd('view') != 'article') || ((JRequest::getInt('id') != 'XXX') || (JRequest::getInt('id') != 'YYY') || (JRequest::getInt('id') != 'ZZZ'))))
{
But the site just gets stuck in a redirect loop with this code. Any thoughts on how to properly expand this to exclude more content?
The topic has been locked.
Support Specialist
14 years 2 months ago #20319 by alzander
Ryan,
Sorry for the delay. The 301 redirect non-SEF to SEF will affect the server side code because even if you redirect the user to a non-SEF URL, when the page loads with that non-SEF URL, the Joomla execution starts anew. At that point, sh404SEF doesn't know how the user got there and simply sees that non-SEF URL and redirects the user again to the SEF version.

As for the redirect, let's try to make that code a little more legible instead of the "OR not equals", which makes it hard (for me at least) to figure out what's going on. That last OR is definitely wrong.. I think you could change the ||'s between the article ID's to && and that would work. Feel free to try that, or update the line to the following:
if ($result && 
  !(
    (JRequest::getCmd('option') == 'com_content') && (JRequest::getCmd('view') == 'article') && 
       ((JRequest::getInt('id') == 'XXX') || (JRequest::getInt('id') == 'YYY') || (JRequest::getInt('id') == 'ZZZ')
    )
  )
)
That can all be on one line, just on many for legibility, to help checking all the parenthesis, and to help call out the ! on line 2.

Hope either of those changes works!
Alex
The topic has been locked.
Active Subscriptions:

None
Thanks for the help Alex!! I was able to get this working (sort of) using the following code:
//Get the article's ID
$articleId = (JRequest::getVar('option')==='com_content' && JRequest::getVar('view')==='article')? JRequest::getInt('id') : 0; 

//ID's of the excluded articles
$dont_redirect = array('XXX','YYY','ZZZ'); 

if($result && !in_array($articleId , $dont_redirect))
{...

For the most part, this works. The only problem I had was with article content that displayed in a lightbox pop up. The pop up was supposed to show the Rules for the sweepstakes, but on the 2 other pages that were excluded in this redirect, the light box always showed the confirmation page. Not sure why this was happening... if I hover over the lightbox link, the URL is SEF. If I right clicked on the link and opened the page in another tab, the non-SEF URL showed in the address bar, but then it redirected to the SEF URL. This functionality is definitely turned off in SH404, so I don't know why this redirect still occurred. Maybe it was JCE or RokBox...?

Long story short, I changed the link on those pages so the Rules just open up in another tab, rather than the light box. Not as slick, but it works. :)
The topic has been locked.