In reply to:
Thanks for the feedback. We basically have two domains that point to the same user account on Dreamhost (ie. the same physical directory, if I understand correctly).
Uh, not exactly what I was talking about.
DreamHost uses named-based virtual hosting. The browser connects to the DreamHost machine and tells the machine what hostname it is trying to visit. This is provided in the "Host" header of the requuest and becomes available on the machine as the HTTP_HOST environment variable.
HTTP requests also include a url-path. This is the part of the URI after the hostname (included the slash) but not the fragment or query string. eg http://example.com/index.php?page=home, the url-path here is /index.php
Now when a request comes into the Apache, it goes through the server configuration looking for special rules to apply to certain uri-paths. It will then traverse the filesystem for .htaccess files with special rules too (this is where mod_rewrite comes in). If no special rules apply, it translates the url-path to a filesystem path and attempts to access that directory or file (what I meant as 'physical') This file system path will be relative to the "document root" (DreamHost calls it the web directory" ie http://example.com/index.php gets mapped to /home/username/example.com/index.php given a web directory of /home/username/example.com
By 'virtual' I meant the 'search engine friendly' urls the like that are 'special', eg the url-path /show/picture/1 gets converted to a call to /index.php?action=show&category=picture&item=1 (which might be the cases if the url is handled by RoR apps too)
In reply to:
I'm guessing that all I need to do is to add some rewrite rules in the HTACCESS file. In my example, www.mysite.com/section needs to be rewritten to www.newsite.com whenever it is encountered.]http://I'm guessing that all I need to do is to add some rewrite rules in the HTACCESS file. In my example, www.mysite.com/section needs to be rewritten to www.newsite.com whenever it is encountered.
There are two different methods, two different words: redirect and rewrite. A redirect tells the browser to go to a different url. So that is what you need to ask for when you want the "address bar to change." A rewrite is where Apache changes the value and uses the new value instead - it doesn't have to tell the browser the value changed - so the "address bar does not change".
Again Now you want a redirect when:
browser asks for http://mysite.com/section/something
server tells browser to ask for http://newsite.com/
browser asks for http://newsite.com/
visitor sees web page from http://newsite.com/
Depending on the conditions, you might be able to use a Rewrite directive instead of a mod_rewrite rule.
Now before we discuss what people see at http://newsite.com/ let me know if you are with me so far.
openvein.org -//-