View Full Version : Conditional redirect
teedee
12-07-2008, 11:17 PM
I have a three domains hosted as a main domain & two parked domains a.com, b.com & c.com. All are pointed to a.com. I want to redirect users to the correct sub-directory while still displaying the url the user typed in. For example if the user enters "http://www.c.com" (quotes used to stop hyperlink creation) the user will be redirected to c.com/c/default.html
I have a basic ability to create web pages but no experience whatsoever with Perl or CGI. Could someone give me a pointer to a reference or a code-clip to get started please.
TIA
td
KevinADC
12-08-2008, 12:11 AM
You probably want to look at htaccess for something like that instead of perl. Google for "htaccess tutorial" and start reading.
teedee
12-08-2008, 07:10 AM
Thanks Kevin
The web hosting already has a .htaccess with the rewrite cond & rules in it. These lines are generated from cPanel and do NOT work the way I want. You cannot redirect (rewrite) the second domain to a sub-directory nor can you redirect the primary domain to a sub-directory (this second point is specified in cPanel). This may be local to the web hosting service(???)
What I want is something like
If aaa.com.au then goto /aaa/
else if bbb.com then goto /bbb/
etc
Should I be considering ASP or something else?
td
KevinADC
12-08-2008, 07:21 PM
I don't know all the ins and outs of htaccess so it could very well be that your host is limiting what you can do with htaccess. If you want to use a server side script to do the redirection then you have to be able to run a script from the root directory of the website and have it do the redirection however you want it to. PHP or ASP might be an easy way to go about this task since you can generally run them everywhere on the website. Ask on an a PHP or ASP forum and see if there is a solution to your problem.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.