Pointing a domain at a nested subdirectory on a second domain

Coral Sheldon-Hess coral at SHELDON-HESS.ORG
Fri Jan 11 21:45:53 EST 2013


Hello!

I have a domain name (let's call it newdomain.org) that I need to point to
a subdirectory of a subdirectory on another domain (olddomain.org/dir1/dir2/).
For political reasons, I need to hide all references to olddomain.org, if
at all possible.

My original plan was to set up a forward, with masking, using the DNS
service we use. That worked OK, but I really want all of the URLs
rewritten, which that wouldn't do--you could still see olddomain.org in
mouse-overs of links. And, obviously, there are some other concerns with
that approach (for instance, you aren't really supposed to be able to do a
DNS forward to anything but a fully qualified domain name, so it shouldn't
have worked; also, it has the potential to really screw up Google's
indexing of the site).

So now I have newdomain.org set up with an address record (Host/A) on DNS,
pointing to the IP address of olddomain.org. I know I need to do a rewrite
of some kind in Apache, on olddomain.org's server. Not a problem. I have
access. But, for the life of me, I can't get it to work. I tried a
VirtualHost entry in httpd.conf, but that led only to pain--or to nothing
happening. Nothing in between.

The code below, in olddomain.org's base directory's .htaccess file, gets as
far as forwarding requests for olddomain.org to newdomain.org/dir1/, but 1)
nothing I do is getting it to make the extra jump to dir2, and 2) it isn't
rewriting the URL.

RewriteCond %{HTTP_HOST} ^(www.)?newdomain.org$ [NC]
RewriteCond %{REQUEST_URI} !^/dir1/dir2/ [NC]
RewriteRule ^(.*)$ /dir1/dir2/$1 [L]

I've been looking at Apache documentation and random bulletin boards all
day, and my eyes are crossing. Can anyone help me? I'd be really grateful!

Thank you!
--
Coral Sheldon-Hess
http://sheldon-hess.org/coral
@web_librarian

============================

To unsubscribe: http://bit.ly/web4lib

Web4Lib Web Site: http://web4lib.org/

2013-01-11
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.nd.edu/pipermail/web4lib/attachments/20130111/391ed695/attachment.htm>


More information about the Web4lib mailing list