Forum Moderators: phranque

Message Too Old, No Replies

Bring other site's root in as subdirectory

         

q_1983

10:36 am on Jul 1, 2010 (gmt 0)

10+ Year Member



Hi,

I'm quite new to dealing with .htaccess, and to these forums. Hope I make sense.

I've been asked to bring one of a few of my client's sites into the main site. So at the moment two sites exist: www.site1.com and www.site2.com

I want this to work: www.site1/site2/ to be the index of site2.

I was hoping that copying the root directory of site2 into the root directory of site1 would work. But the pages on site2 have image links like

src="/images/somepic.gif"

which gets resolved to the parent directory due to the leading slash.

What I want is for pages served from the subdirectory to treat the subdirectory as the root directory, so /images/somepic.gif gets resolved to /site2/images/somepic.gif

I've spent ages researching and trying to figure this out. I was hoping maybe a RewriteBase directive in the .htaccess of the subdirectory would work:

RewriteBase /site2/

But it doesn't seem to. I don't know if thats because my directive wont work, or perhaps its not being used.

Any help greatly appreciated!

Q

phranque

9:39 am on Jul 3, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



try using RewriteCond to test for the site2.com domain in the request and use RewriteRule to internally rewrite all such requests to the /site2/ subdirectory.