Forum Moderators: phranque

Message Too Old, No Replies

Redirect to another folder

         

SirCawe

8:13 pm on Apr 21, 2010 (gmt 0)

10+ Year Member



Im trying to redirect all the containg from:
www.site2.com

to:
www.site1.com

In the server, I have this:
for site1.com /home/sircawe/public_html/
for site2.com /home/sircawe/site2/public_html/

So when someone write www.site2.com, I want to redirect ALL the contain for /home/sircawe/public_html, but still showing the address www.site2.com and all the containing, like www.site2.com/site.php

The /home/sircawe/site2/public_html have nothing but the .htaccess

Someone?

jdMorgan

8:35 pm on Apr 21, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> I want to redirect ALL the contain for /home/sircawe/public_html, but still showing the address www.site2.com and all the containing, like www.site2.com/site.php

This is not possible with a redirect, since a redirect tells the browser to ask again for what it wanted, but using a new URL. When the browser does this, it updates its address bar to show the new URL.

If you have server admin privileges, it is possible to use a proxy through-put instead of a redirect, but this has several problems:
  • All requests for site1 pass through the site2 server, consuming bandwidth and CPU resources.
  • All requests for site1 are logged on the site2 server -- polluting the logs with extra requests, and ruining the usefulness of any 'statistics' on the server for use in marketing.
  • If the site2 server fails, site1 becomes inaccessible.
  • All requests for site1 are logged as coming from site2 -- The information to determine the actual "user" is lost, unless an X-Forwarded-For HTTP header is sent from site2 to site1, and that header is logged on site1 instead of the usual Remote-Addr header. This requires server admin privileges on both servers.
  • All pages on site1 and site2 appear to be duplicates, and will compete with each other for links and for ranking in search engines. As a result, neither will do as well as they should. This is sometimes called (erroneously) a "duplicate-content penalty." It is not in fact a penalty, but rather just that you have created additional "competition" for your own pages.

    If both sites share the same filespace, then an internal rewrite (not a redirect) can be used to do what you ask. But again, the duplicate-content problem will assure that neither site's pages rank as well as they should. Typically, this would be implemented using using Apache mod_rewrite -- See the Apache documentation for more information.

    All-in-all, though, it's not really a very good idea.

    Jim
  • SirCawe

    9:03 pm on Apr 21, 2010 (gmt 0)

    10+ Year Member



    Its not possible to do that with .htaccess?


    <VirtualHost *:80>
    ServerAdmin webmaster@domain1.com
    DocumentRoot /public_html
    ServerName domain0.com
    </VirtualHost>

    <VirtualHost *:80>
    ServerAdmin webmaster@domain2.com
    DocumentRoot /public_html
    ServerName domain1.com
    </VirtualHost>