Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here's the situation:

I recently re-structured my website at www.pixelscrapper.com. I still have the old legacy website at legacy.pixelscrapper.com (hosted on the same server). Is it possible to use an Apache htaccess rewrite rule to make my legacy content appear available under a subdirectory on my new site?

In other words: I want to be able to go to www.pixelscrapper.com/legacy/some-folder/some-item and see the content which is actually located at legacy.pixelscrapper.com/some-folder/some-item.

Have been searching around without much success. I thought something like the following might do the trick, but maybe I'm way off?

RewriteCond %{HTTP_HOST} ^pixelscrapper.com$
RewriteRule ^/legacy/?$ http://legacy.pixelscrapper.com/ [R=301,L]
share|improve this question
    
Either do redirect to the legacy site (users will see different URL in the address bar of the browser) or setup a reversed proxy (it'll look like the content is on the same site, but all traffic will go thru the main server) –  Kamil Šrot Nov 20 '12 at 8:50
    
Is it necessary to use a reverse proxy even if the legacy site is hosted on the same server? No way to simply do it through htaccess? The main issue here is SEO and link juice: I want all the legacy content to be served from the same domain as the main site (so I don't want to redirect to legacy.pixelscrapper subdomain)... –  Jordan Magnuson Nov 20 '12 at 9:05
    
Theoretically it's possible, but if it's a hosting server, it'll be not supported / isolation of accounts is the most important part of shared hosting security - anyway, it's not the biggest problem, the same can be achieved by the proxy request using mod_rewrite and P switch to the RewriteRule / the problem is how to fix URLs inside the content of your legacy site, to point to the www.pixelscrapper.com/legacy/ and this w/o mod_proxy_html... what about to talk with your hoster? Or can you modify the legacy site so, it'll produce the correct URLs? –  Kamil Šrot Nov 20 '12 at 12:28
    
Thanks for your help Kamil... it turns out that setting up a reverse proxy with apache mod_proxy is easier than I expected, so that's what I've done, and it's working like a charm. Thanks for pointing me in the right direction! –  Jordan Magnuson Nov 20 '12 at 12:44
    
No problem. Cheers! :-) –  Kamil Šrot Nov 20 '12 at 12:50
add comment

1 Answer

up vote 0 down vote accepted

It turns out that the way to achieve what I was after is to set up a reverse proxy using Apache's mod_proxy... which is actually pretty easy to do. There's a good tutorial on this at http://www.apachetutor.org/admin/reverseproxies

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.