Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Redirect stuck in loop
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.
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
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
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.
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Redirect stuck in loop
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5942
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7624
- Newest User:
- borger3298
- Members Online:
- 1
- Guests Online:
- 195
- Online:
- borger3298
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked