Welcome Guest | Login

kind of strange url rewrite

So I'm trying to do a strange kind of url rewrite, and I wonder if it's possible. So let's say my rails app is hosted at:

www.myapp.com

and that there are several users that have their own site on it like this:

www.myapp.com/1, www.myapp.com/2, etc

is there any way to do something where i could point another domain, like www.otherdomain.com to point to www.myapp.com/1 and to have it remain in the url? So when someone goes to www.otherdomain.com it's really at www.myapp.com/1 but it still says www.otherdomain.com in the url. Also, could I do something where if I did www.otherdomain.com/stuff/show/43 it would really point to www.myapp/1/stuff/show/43, but www.otherdomain.com/stuff/show/43 would remain in the url.

anyone know if this is even possible? this does seem kind of strange, but i promise it's not for anything bad.

2007-02-20 03:47 AM

also, if i pay for a domain, and i point it to the hosting rails nameservers, how do i get it to point to www.myapp.com/1 ?

2007-02-20 03:49 AM

Hi Vikas,

I don't think what you are asking for is possible using a rewrite rule. Most of the browsers will detect it as a phishing attempt.

You may use iframes in www.otherdomain.com/stuff/show/43/index.html, this works well as per my knowledge.

2007-02-20 05:29 PM

Maybe you can soft link ~/public_html/myapp/1 to ~/public_html/otherdomain and then add otherdomain.com to your addon domains.

2007-02-23 07:33 AM

As for running multiple apps under one account see this:
http://www.hostingrails.com/forums/wiki_thread/6

The rewrite's I think Fastcgn is right... you'd cause trouble with peoples browsers.

Seth

2007-02-24 04:18 PM

Seth
i figured out a way to do this. basically you add each domain as a parked domain on top of your main domain. so if my main domain is www.example.com, you park www.addondomain.com on top of it. this sets things up so that there's no redirection.

then in the controller, you can read the domain using the request object (@request.domain), and then load an id by checking a mapping in the database or a file somewhere.

as long as your links are relative, the url the user typed in originally stays there.

2007-02-28 03:50 AM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!