views:

271

answers:

3

firstly, i have already spents the past few hours trying to find a solution for this, but have had nothing but non-working solutions :(

it's pretty simple - i'm pointing the DNS of a new domain to my current hosting. but when i visit the new domain, i'm just viewing my original site (the one i got with my hosting).

let's say my original site is "www.originalsite.com" - the content for my new domain is at "www.originalsite.com/newsite.com/" (dots included). now i just need to get "www.newsite.com" to re-direct to it's own directory AND re-write itself to hide the directory name. so yeah, "www.newsite.com" needs to use the content in "www.originalsite.com/newsite.com/", but remain displayed as "www.newsite.com" in the URL bar.

Cheers for any input - really appreciated :)

PS i'm using Coldfusion and previously made a useful re-direction, but the result was typically "www.netsite.com/newsite.com/" - which is cack :)

oh.. and yeah, i'm hoping for an htaccess fix :) thanks!

+3  A: 

If you have full control over the server, a VirtualHost in httpd.conf is probably a better solution. For example:

<VirtualHost newdomain.com:80>
    ServerName newdomain.com
    ServerAlias www.newdomain.com

    DocumentRoot /path/to/webroot/newsite.com

</VirtualHost>


If you don't have the ability to do this directly, any good host will provide a "Park Domain" function which allows you to achieve the same effect - specifying your new domain and identifying which directory you want it to point to - via the web control panel.


However, if you don't have the ability to do that, here's a mod_rewrite for .htaccess that should work:

RewriteEngine On
RewriteCond %{REMOTE_HOST} (www\.)?newdomain\.com
RewriteRule ^(.*)$ /newdomain.com/$1 [L]
Peter Boughton
thanks, but it didn't do anything :(i'm wondering if i'm even using it properly?all i have is a file name ".htaccess" in my site's root directory, and inside the file i pasted your rewrite code. am i missing something? should i be placing "mod_rewrite" somewhere?and no, i don't have control over the server :)cheers!
Make sure it is in the webroot not the home directory (i.e. it should be in the ~/www or ~/public_html directory).I'm fairly certain mod_rewrite is standard with Apache, so you shouldn't need to do anything there.
Peter Boughton
Also worth checking - does your host provide any form of control panel (i.e. cPanel, Plesk, DirectAdmin, etc) where you can setup "parked domains" (or similarly named).If so, that functionality will do what you want, probably through a nice user-friendly interface.
Peter Boughton
i've placed the file as far back as possible...but this host doesn't seem to present me with a /www or /public_html directory. instead i just have my /originalsite directory.also, they're using something called WebControlCenter :\ and it's "extra domain" features are pretty limited. all i've been able to do so far... is point the DNS. their knowledgebase feature was giving me coldfusion code for redirecting the user from "originalsite.com/index.cfm" to "originalsite.com/newsite.com/", which has felt like a bit of a bodge job, so to speak...
the knowledgebase also gave me some htaccess code previously, but that wasn't working either :(
Hmmm. WebControlCenter is CrystalTech, who only appear to do Windows/IIS based ColdFusion hosting. Until the very latest version, IIS didn't do url rewriting (without 3rd party plugins), and I'm not sure if it will (fully) support the ModRewrite syntax.
Peter Boughton
Might be worth posting this question on cf-talk - where you're more likely to find other CrystalTech users who have encountered/solved this problem already - and if you get a solution come back here and post details. :)
Peter Boughton
This answer ought to work if they're using Apache. Without it... well, good luck. Deserves an up-vote anyway =p
easel
A: 

You could do the redirect with a "cloaked" frame page. That way the URL in the browser's address bar stays the same (no extra path), and it remains simple to use the subdirectory.

The following link describes this for classic ASP - but it should be simple to convert to any server side scripting language/platform: http://www.simpledns.com/kb.aspx?kbid=1151

Jesper
+1  A: 

CrystalTech have just recentely installed a mod that provides htaccess ...

Though they've only done it one server so far :) so I'm being moved onto that server.

Problem solved I guess - heh!

PS thanks for the help anyway guys :)