Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,153,618 members, 7,820,186 topics. Date: Tuesday, 07 May 2024 at 11:06 AM

How To Redirect A Sub Domain? - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / How To Redirect A Sub Domain? (689 Views)

How To Use Custom Domain/sub Domain Name For Your / How To Redirect 1and1 Domain To Your Bloggers Blog / Should I Put My Blog In A Sub-directory, A Subdomain Or On Its Own Domain? (2) (3) (4)

(1) (Reply) (Go Down)

How To Redirect A Sub Domain? by chrishenzo: 7:08pm On May 31, 2011
Can someone tell me how I can redirect from main directory to sub domain.

For example I have a website called www.example.com and a sub domain site called forum.example.com. When a user visit forum.example.com, since the user is not yet loged in, the user will be directed to the login page (which is in the main directory).
How can I redirect the user back to forum.example.com after the user must have loged in instead of going to www.example.com/index.html

Please help me out here.

A good example of what I mean can be found on yahoo.com

If you visit uk.eurosport.com and click on sign in, it will take you to yahoo login page. When you log in, it will take you back to uk.eurosport.yahoo.com. This is exactly what I want to achieve. Help me out guys
Re: How To Redirect A Sub Domain? by Nobody: 7:34pm On May 31, 2011
You can redirect with php

<?php
header("Location:forum.example.com"wink;
?>

or

<script>location.href("forum.example.com"wink;</script>
Re: How To Redirect A Sub Domain? by DualCore1: 11:07pm On May 31, 2011
Babe enters member.example.com but is not logged in.
Detect no logged in session for this babe,
Take babe to login page and also take along "member.example.com" as a variable you can call "referrer".
On successful login, redirect babe to referrer.
On failed login redirect babe to me.

That is the logic, breathe life into it in any server-side language you are comfortable with.
Re: How To Redirect A Sub Domain? by chrishenzo: 2:45am On Jun 01, 2011
*dhtml:

You can redirect with php

<?php
header("Location:forum.example.com"wink;
?>

or

<script>location.href("forum.example.com"wink;</script>




Could you please tell me where I should insert the script. Should I put it in the login page or where?
Dual Core:

Babe enters member.example.com but is not logged in.
Detect no logged in session for this babe,
Take babe to login page and also take along "member.example.com" as a variable you can call "referrer".
On successful login, redirect babe to referrer.
On failed login redirect babe to me.

That is the logic, breathe life into it in any server-side language you are comfortable with.

Can you tell me how to do that?
Re: How To Redirect A Sub Domain? by Nobody: 7:04am On Jun 01, 2011
What programming language are you talking about? i have already given you two examples: javascript and php

(1) (Reply)

say / Please Review Www.martinuwakwe..com / Minecraft

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 11
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.