Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

redirect relative links of component to url

redirect relative links of component to url

Hi,

I have 2 urls using the same Joomla 2.5 so it appears as 2 separate websites, one the parent and one the event. I did not use the cookie method to load the templates because the menu method served this purpose better for my situation. However, using JCE and configuring it to use relative linking presents a problem with one component. This component must run under the parent but is referred to for payment collection under the event.

Can I set up a rule so that even though a menu or link within an article is relative, if it goes to a specific component then it goes from the event url to the parent url? I don't need to disguise anything when it redirects as the event is a fundraiser for the parent.

Thanks,
Helen

helenbn
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: redirect relative links of component to url

For example:

http://myeventsite.com/sponsor-this-team

will show as /sponsor-this-team in JCE. Since it is triggered in the myeventsite.com, it has this base url and template.

I want it to redirect to

http://myparentsite.org/sponsor-this-team

helenbn
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: redirect relative links of component to url

Hi Helen,

Are you saying that /sponsor-this-team should be allowed on both sites under some conditions? Or that it must ONLY be shown on the parent site?

If it should only even show on the parent site, then you could make a rule based on that menu item, or based on finding that exact text in the URL (URL contains text...).

Then for the redirection, can you use the redirection tools provided, or do you need to be able to redirect to a more dynamic URL?

Is that what you're after or have I misunderstood the complexity?

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Re: redirect relative links of component to url

Hi Stephen,

The link must only load on the parent site and it would always be a dynamic URL. So to be clear and for examples:

I have a Joomla 2.5 site with 2 domain names. One is the parent site, http://pccse.org/ and one is the special event site http://smldragonboatrace.com/. The templates are different and the menus so it looks like 2 entirely different sites. The control is through Chameleon based on menu.

I am using CiviCRM http://civicrm.org/ to handle contributions for the parent site as well as the event site. However, due to restrictions with both the CiviCRM configuration and the PayPal account, only one URL can be using the account(s). This would be the actual organization, pccse.org.

I am also using JCE for the WYSIWYG and have it configured to handle links relatively. We all know this is preferred.

So the problem occurs when I need to create any type of link from the event site to the component CiviCRM, it carries the event url and not the parent unless I toggle editor to html and save from there. This is too hard for my client and too messy.

I need it to redirect everything like this:
http://smldragonboatrace.com/index.p...task=civicrm/*

to:
http://pccse.org/index.php?option=co...task=civicrm/*

and ideally work with SEF

so:
http://smldragonboatrace.com/sponsor-this-guy

would go to:
http://pccse.org/sponsor-this-guy

I don't know if this can be done with Chameleon or if I need to do it from the .htaccess. Either way, I don't know how.

Thanks,
Helen

helenbn
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: redirect relative links of component to url

Hi Helen,

A couple of things:

1 - (just FYI) the easiest way to give different templates for different domain names is to set it up per domain name rather than by menu item. That's an option in Chameleon.

2 - what I am missing from your explanation is just what distinguishes the URLs that need to be handled in the parent, from the URLs that need to be handled by the event site. When the request comes in, Joomla can tell the difference between whether something was relative or not. That's handled by the client (browser) which converts relative URLs to absolute URLs to send as an HTTP request.

So, what things distinguish the parent URLs? Are they pointing to particular menu items? Do they all point to the CiviCRM component, so that you could say "everything that points to CiviCRM has to be on the parent domain"? Or anything else?

.htaccess may be an option if there's a pattern to the exact URLs that need to be redirected. Otherwise, Chameleon has access to the underlying component and URL parameters (even with SEF enabled) and that might make it easier to define the rules about which things get redirected or not.

But I still need to understand what those "rules" are in your case...

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Re: redirect relative links of component to url

Hi Stephen,

Sorry for the delay - on a brief holiday smile.

1. I don't understand here, but if I want a different template with different menus, then mustn't I do this based on menus? I set it up in Chameleon based on Menus (not items - sorry) so each template has a different Main and footer menus.

I have the parent URL as the main hosting account and the event URL parked. Then I have a hosting redirect pointing the parked event URL to the Home of the Event Main Menu.

2. So, with all relative links from the event URL, they retain the event URL beginning since they originate from that URL. This won't work.

I need everything that points to CiviCRM to point to the parent URL.

Thanks,
Helen

helenbn
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: redirect relative links of component to url

Ok, here's how I understand the situation:

1 - you have set up the same Joomla site so that it responds on 2 different domain names, parentsite.com and eventsite.com. (set up with cPanel or simiilar)

2 - relative links in eventsite.com need to point back to parentsite.com for payment. This goes for certain URLs, not all URLs that might appear on eventsite.com. In general it's going to be the "relative" ones that appear in articles etc that need to be redirected, not the menu ones.

3 - it's impossble for Joomla to know the difference between relative URLs and absolute URLs once the link has been clicked on. The request that reaches Joomla is the same in each case.

4 - it may be possible to create a system plugin which parses the page before it is output in order to detect relative links and add the correct domain name to them. But the rest of my solution ignores this possibility and tries other approaches.

5 - the approach therefore would be to check incoming URLs and see if these are to eventsite.com and to menu items or components which are NOT supposed to be handled by eventsite.com. These would be trapped then redirected to the same URL on parentsite.com.


Therefore my question is how to know which URLs on eventsite.com should be redirected. Presumably there are going to be some URLs that DON'T need to be redirected. e.g. the volunteer signup. I guess this is a CiviCRM URL? If so, we can't just say "all CiviCRM URLs have to be redirected".

So can you start to draw up a list of all the ones which DO have to be redirected? Or perhaps there's a small subset of ones which DON'T have to be redirected and it might be quicker to make a list of those. The main thing really is to be able to make a rule that won't need to be amended in future if you add new types of pages for any reason.


Hope that makes sense,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Re: redirect relative links of component to url

Hi Stephen,

I ran out of time to solve this last year and did a work around with external urls in the menus. It was not fun. sad But this year my client is starting earlier so I have more time to fix this. smile

I want all CiviCRM component URLs, messy and SEF, to go from myeventsite.com to myparentsite.org. I want them from within the site in an article with JCE, in a menu, and from a direct link from outside the site (like in an email).

Thanks,
Helen

helenbn
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Re: redirect relative links of component to url

Ok, how does this sound? We set up a MetaMod in which to run the PHP code on all pages. This PHP will check for 2 things:

1 - are we on myeventsite.com?
2 - are we on a CiviCRM page?

If both conditions are met, it will redirect to the same URL on the myparentsite.org site.

To do this, you could use the following PHP:

if ($_SERVER['HTTP_HOST']  == 'myeventsite.com'
  and $option == "com_civicrm") {

  $uri = JUri::getInstance();
  $uri->setHost("myparentsite.org");
  $app  = JFactory::getApplication();
  $app->redirect($uri->toString());
}

Hope that helps,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3319 Posts
User info in posts
Administrator has disabled public posting

Re: redirect relative links of component to url

Hi Stephen,

Sorry for the delay - gmail keeps spamming your replies. sad

I ended up using a combination of .htaccess and Chameleon to do it all basically because I also had to keep up with some exceptions and template control ... and I didn't check back here for the reply. hmm  However, I maybe able to use your solution instead ... Which do you think would make the site load quicker, or is that a loaded question?

Thanks,
Helen

helenbn
Beginner Modder
ranks
useravatar
Offline
7 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1675
Total Polls:
6
Total Posts:
5917
Posts this week:
6
User Info:
 
Total Users:
11570
Newest User:
moises1247
Members Online:
1
Guests Online:
207

Online: 
moises1247

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked