Closed Thread Icon

Topic awaiting preservation: URls pointing to diffrent directorys (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12685" title="Pages that link to Topic awaiting preservation: URls pointing to diffrent directorys (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: URls pointing to diffrent directorys <span class="small">(Page 1 of 1)</span>\

 
Trigger
Paranoid (IV) Inmate

From:
Insane since: Jun 2002

posted posted 04-07-2003 20:11

Ok... I know what I wanna know, just not how.. to explain
it lets try this way

I have 2 domains www.a.com and www.b.com

I have one webhost, my web host can "park domains" but cant point them at sepcific directorys. . I dont know why.. what I want to know, is there anyway in php,perl or htacsses to check the url thats calling the file?
so when
the url is www.b.com it eill forward it to /b/ and when its www.a.com it will send it to /a/ ??

Thanks
Trigger

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 04-07-2003 20:23

Trigger: It depends on what your hsoting is on (sounds like Apache) but it pos. sounds like a job for mod_rewrite and/or a few configuration tweaks in your htaccess (although I can't be too sure).

For mod_rewrite look here:
http://development.gurusnetwork.com/links/167/

and have a nose around the Apache manual (I have something similar running on my home PC for testing but I'm not sure if you can sort that host configuration from htaccess).

___________________
Emps

FAQs: Emperor

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-07-2003 20:32

sure easy enough in PHP $_SERVER['HTTP_HOST'] or (deprecated) $HTTP_SERVER_VARS['HTTP_HOST']

should give you the request host info which can be easily parsed.

So something like

<?php
if (preg_match("/www.a.com/i", $_SERVER['HTTP_HOST'] )) {
header('Location: /a');
}
// The else here is optional, you could just keep them here or stack the elses
else {

header('Location: /b');
}

?>



.:[ Never resist a perfect moment ]:.

Trigger
Paranoid (IV) Inmate

From:
Insane since: Jun 2002

posted posted 04-07-2003 20:48

Thank you both

Bit, I thought thwere was a way to do it in php but coudlnt find the resource and was assured by 2 other people it coudlnt be done, thanks for the result

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 04-07-2003 20:51

Well I'm going to add a caveat which is that it depends on how the forwarding is done. (the orginal request headers have to be sent) but it should work

Could be done in perl just as easily too.



.:[ Never resist a perfect moment ]:.

« BackwardsOnwards »

Show Forum Drop Down Menu