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 stuck in loop

Redirect stuck in loop

Hi

I have just purchaced the full version of Chameleon. I have managed to get it to detect mobile devices and display the mobile template I created. However I want to be able to redirect people to the home page from all other URLs to the site. But the problem is that it gets stuck in a inifite loop. I am unfamiliar with PHP but I am guessing I need to add a custom PHP code that says if not homepage then redirect otherwise don't redirect.

Would you be able to give any help in what code I would need to add. I don't understand why Chameleon has this default functionality as I can't imagine a situation where you want an infinite redirect? Shouldn't this be a built in feature that says once redirect has occured then stop.

anijack
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Redirect stuck in loop

I have tried this in the SUCCEED actions run PHP text box but it is still stuck in an infinite loop.

<?php
     $homepage = "/index.php/home";
     $currentpage = $_SERVER['REQUEST_URI'];
     if($homepage==$currentpage) {
     return false;
  }
?>

anijack
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Redirect stuck in loop

Ok things are just going form bad to worse. Firefox is now blocking me from accessing the page saying "Firefox has detected that the server is redirecting the request for this address in a way that will never complete". I am now using this code and I am certain there is no reason why you shouldn't work.

$currentpage = $_SERVER['REQUEST_URI'];
if($currentpage=="/" || $currentpage=="/index.php" || $currentpage=="/index.php/home" ) {
return false;
}

Could you please advice as to why the redirect is not working correctly.

I am on Joomla 1.5 using Chameleon 1.5

anijack
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Redirect stuck in loop

Hi,

first of all, you don't need the <?php and ?> things in the PHP box -- everything in the PHP box is assumed to be PHP. This could be part of the reason it's not working.

The second thing is just to be sure of what you are wanting to achieve. Are you really saying that you want all people who try to get to any other page on your site to get redirected to the front page? So are you blocking people from reaching those pages totally?

Or do you mean that you want everyone to get sent to the front page the *first* time they hit your site, then after that they are free to visit any of the other pages?

These details matter. There are many things you might want to do and many ways to achieve them, so Chameleon doesn't make assumptions like "if you are already on this page I shouldn't redirect to the same page again". But you can achieve exactly that by making a rule that detects if you are already on a particular page, and not redirecting in that case, just as you suggested.

So can you provide some more details about what you want to achieve?

Thanks,
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
3314 Posts
User info in posts
Administrator has disabled public posting

Re: Redirect stuck in loop

Hi,

Apologies for the lack of clarity. I wanted to redirect user away from all pages because my client wants only the news pages (homepage) to be visible to mobile users. This is due to the fact that they don't have the budget for us to make the whole site fully mobile friendly.

I have realised now that I was going about the problem all wrong and I have found an alternate solution using php to hide and show modules and content based on what page the user is on. Thanks for your time.

anijack
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1691
Total Polls:
6
Total Posts:
5912
Total Posts Today:
6
User Info:
 
Total Users:
11515
Newest User:
velis415
Members Online:
0
Guests Online:
259

Online: 
There are no members online

Forum Legend:

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