.htaccess like a dns redirect

design

#1

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.


#2

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


#3

no one is in a different host.


#4

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
$97 off using [color=#CC0000]LuckyYou[/color] promo code :cool: . Sign Up NOW


#5

and there are a why to emule a dns redirect?

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


#6

With mod_rewrite rule should do that nicely.

Get YOUR $97 off on yearly plan with [color=#CC0000]YOUGET97 [/color] promo code. Sign Up NOW


#7

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 [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#8

but how i can use mod_rewrite

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


#9

[quote]but how i can use mod_rewrite

for link a dreamhost site to a other one in other provider?[/quote]
What you are asking for requires a proxy. Contact support and ask them if they load the mod_proxy module and allow the passthrough flag. If they say no, then you cannot do what you want to do.

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7