View Full Version : Need help with redirect code. not really sure how to do this...

12-10-2010, 03:03 AM
I know zero php. I need help with this problem as soon as possible.

Basically what I need to do is the following:

if the viewer came from xxrandomxx.com, then this page wouldn't redirect.

If they came from anywhere else, then I want the page to take them to xxrandomxx.com

Do any of you have any ideas of how to do this or achieve a similar goal?

I need to do this because only xxrandomxx.com is password protected and none of the other subfolders/files are, so on google they show up and arent protected but they need to be.

12-10-2010, 06:20 AM
hi, ok im alittle lost here so if they come from site1 you want to not redirect them, but if they come from anywheres else you want to take them to site1.... ok thats confusing...

im thinking you dont need php code per say, you need a mod rewrite and some htaccess stuff...

please clarify

12-10-2010, 07:09 AM

header('Location: http://xxdomainxx.com');

Just make sure you have it at the top of your page or it will throw an error. This will make it so if an outside website comes to yours, it will redirect to that main page. I don't know what to say about referrals from within your website. You'll need to start setting some sessions to get that done.

12-10-2010, 03:41 PM
Thanks soneen!

I havent checked it yet, but it looks good.

What would I write for server name and header?

Also what are referrals and sessions?