Forum Moderators: phranque

Message Too Old, No Replies

Multiple Domains pointing to one site - How?

         

pmweb

11:57 pm on Oct 17, 2010 (gmt 0)

10+ Year Member



I just got a new virtual dedicated server from 1&1 running linux and plesk 9. I have a domain - domain1.com - with my site. The site also have forums at www.domain1.com/forums.

I also have more domains - domain2.com, domain3.com, domain4.com, and domainforums.com.

I setup a domain alias in plesk with domain2.com, just to see what it does. Now when people go to domain2.com, it loads my site at domain.com, but the address bar still says domain2.com.

I have three issues I need some help with, as I have little experience with Linux, Apache, mod_rewrite, and .htaccess stuff.

Number 1: I'd like all my alternative domains to go to domain.com, and do a full redirect so that the alternative domains don't show in the address bar. So if you go to www.domain2.com, or domain3.com, etc. (with or without the www. before the domain), it will send you to www.domain.com. I'd also like it to send the full path and query string, so if you go to www.domain2.com/thing/stuff/yeah.html?name=John it redirects you to www.domain.com/thing/stuff/yeah.html?name=John. It seems like a common easy problem, but I need help.

Second, I'd like the domainforums.com domain to do the same as above, only domainforums.com should go to www.domain.com/forums, and domainforums.com/viewthread.php?id=123 should go to www.domain.com/forums/viewthread.php?id=123. Understand?

And third, I'd like domain.com to always reformat itself to www.domain.com in the address bar for my visitors just to make things consistent.

If anyone can help with these issues I would be super appreciative!

jdMorgan

12:48 am on Oct 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The first question to ask is, what do you intend to do with these alternate domains?

It would be a mistake to link to them or to encourage anyone else to link to them, since you'd effectively be linking to a URL that always redirects. Soon after you did this, you'd see "complaints" showing up in your Google Webmaster Tools account(s), basically telling you not to link to a URL that redirects; They don't like that because it wastes their time and resources.

On the other hand, perhaps you're just cleaning up some old mess. But a description of that mess would be helpful in determining the technically-correct solution -- both within the server and with respect to avoiding damage to the ranking of your core site.

How you answer that question pretty much determines the focus of this thread.

Our Charter here requires that you post your best-effort at coding a solution as a basis for discussion. This helps establish what you already know, and demonstrates your familiarity with easily-available on-line resources such as the Apache mod_rewrite documentation, and with the basics of regular-expressions pattern-matching -- a critical component of using mod_rewrite, other Apache modules, and most modern scripting languages. The resources cited in our Apache Forum Charter and the tutorials and threads in our Apache Forum Library may prove useful in this regard.

Links to both are at the top of this page.

Thanks,
Jim

g1smd

7:57 pm on Oct 18, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This could end up being a trivial couple of lines of code, or more than a dozen, but it would be a mistake to try to guess at the code required, or to start coding without fully considering all of the questions above.