Log in

View Full Version : Redirecting people to the typed in address.



stsenarist
09-02-2008, 03:48 PM
Hi, another noob here, I have been looking for a script I can't find anywhere can you help?

I have 4 addresses and 1 domain. Since they're all on the same domain, I can really have only one index page. So I would like to come across a script that I can add to my index page(first address) to redirect client to another address, if they have typed another address to the address bar.

Example.
Client types in address http://www.firstpage.com/, but actually ends up on another page's index > lets say she arrives here http://www.secondpage.com/, but this page has a script in it that detects what the client has written in her address bar and thus redirects her on the page http://www.firstpage.com/...

Any help is welcome

BLiZZaRD
09-02-2008, 03:52 PM
Does your host not provide domain pointers?

You can use php to redirect, .htaccess as well.. many things, but you want to appear to have 4 different sites, then pointers are the way to go.

techietim
09-02-2008, 03:56 PM
Not sure if this is what you're looking for, but this is what I interpreted from your message.

Client does to http://seconddomain.com/(STUFF HERE) and gets redirected to http://firstdomain.com/(SAME STUFF HERE). If that's what you're trying to accomplish, create a .htaccess file on http://seconddomain.com and place the following contents in it:


RewriteEngine On
RewriteRule (.*) http://firstdomain.com/$1 [R]

(replace firstdomain.com with your real domain)

stsenarist
09-02-2008, 04:00 PM
Sadly my host is an Estonian company that only sells web spaces without any scripting support/help.

The other pages can be other folders as long as the redirecting works. Lets say the client enters firstpage.com in the address-bar and ends up on secondpage.com, but is then redirected in an instant to "info.firstpage.com
It really doesn't matter where she ends up as long as the .com site she entered ends up the content page that she was looking for.

I actually don't need to redirect people on all four sites, right now I would like the two most active addresses to work like described.

stsenarist
09-02-2008, 04:18 PM
Not sure if this is what you're looking for, but this is what I interpreted from your message.

Client does to http://seconddomain.com/(STUFF HERE) and gets redirected to http://firstdomain.com/(SAME STUFF HERE). If that's what you're trying to accomplish, create a .htaccess file on http://seconddomain.com and place the following contents in it:


RewriteEngine On
RewriteRule (.*) http://firstdomain.com/$1 [R]

(replace firstdomain.com with your real domain)
I think this is an excellent idea. The funny thing is I've never heard of htaccess, but I'm google'ing it allready. Thanks for the hint - I'm really impressed by the fast replies:) cheers!