.htaccess like a dns redirect

.htaccess like a dns redirect

Posted by: Soshen
Posted on: 2007-06-19 10:06:00

Hi, I've a problem:

i need set up a dns redirect only for a subdomain.

i think that should be possibile with a htaccess file, but all the time when i tried, i lose T_T


that i want is:

if someone write the url sub.mydomain.com/pippo/pippo.php in his webclient
(ofcourse sub.mydomain.com is a full hoster subdomain)

the url that are writed in the bar is sub.mydomain.com/pippo/pippo.php
but the page pippo.php for real are hosted in mydomain2.net/file/pippo.php

it's possibile that?


htaccess is the only one way for do it?

thanks.

Re: .htaccess like a dns redirect

Posted by: aixccapt99
Posted on: 2007-06-19 13:35:00

if both domains are hosted in one account at dreamhost, you can try a symbolic link from one directory to the other; that might be the simplest

Re: .htaccess like a dns redirect

Posted by: Soshen
Posted on: 2007-06-19 16:15:00

no one is in a different host.


Re: .htaccess like a dns redirect

Posted by: TryToBeLucky
Posted on: 2007-06-19 23:43:00

Yes... I think .htaccess is the only way to do it. If not try rewrite HTTP header using PHP's header() function.



T-T-L

Re: .htaccess like a dns redirect

Posted by: Soshen
Posted on: 2007-06-20 15:40:00

and there are a why to emule a dns redirect?

i mean leave the original url (the changing dont should be noticed by user)

Re: .htaccess like a dns redirect

Posted by: dinochopins
Posted on: 2007-06-22 04:42:00

With mod_rewrite rule should do that nicely.



Re: .htaccess like a dns redirect

Posted by: Atropos7
Posted on: 2007-06-22 21:42:00

In reply to:

and there are a why to emule a dns redirect?


Short answer: Yes and No.

Long answer:

When re-writing a URL if the hostname changes it is necessary to send a redirect to the browser.

DreamHost will let you specify the document root ("Web Directory") of each site you host. So you can have more than one site hosted from the same directory, or even host sites from a subdirectory of another. And they also allow you to alias url directories to different file system directories using "Remap Sub-dir"

So by using a combination of mod_rewrite and changing the document root or using aliases you can re-write between sites in a more complicated matter than normal. What I mean by that is you would need to add a condition that checks the server hostname variable to determine which site is being accessed or adding an extra path part to the result.

cool openvein.org -//- One-time $50.00 discount on DreamHost plans: Use ATROPOS7Edited by Atropos7 on 06/22/07 09:45 PM (server time).

Re: .htaccess like a dns redirect

Posted by: Soshen
Posted on: 2007-06-23 23:35:00

but how i can use mod_rewrite

for link a dreamhost site to a other one in other provider?

Re: .htaccess like a dns redirect

Posted by: Atropos7
Posted on: 2007-06-24 09:08:00

In reply to:

but how i can use mod_rewrite

for link a dreamhost site to a other one in other provider?


What you are asking for requires a proxy.

Tags: htaccess filemydomainsubdomain