foo.bar.com/baz/* -> new domain.com/*?
March 22, 2006 10:34 AM   Subscribe

Is it possible to implement domain-part redirection on URLs, along these lines: http://foo.bar.com/baz/0001.html becomes http://new.domain.com/0001.html for any instance of "foo.bar.com/baz/*", that segment of the URL is replaced by "new.domain.com/*" If so, are there multiple methods? [MI]

I think that this is possible if you have httpd.conf access under apache; however, in the instance I'm trying to learn about, I do not have that level of admin access. I do have DNS control over the second domain, but not the first. The page set at the first domain is my content, hosted by a commercial aggregator.

I think I might be able to accomplish this by setting up a script at "new.domain.com" which would parse incoming URL requests and transfer the visitor to the "foo.bar.com/baz" URL.

Is there a readymade script I can gank to accomplish this?

can i do what i need just in DNS?

TIA!
posted by mwhybark to Computers & Internet (8 answers total)
 
If you don't have the ability to modify httpd.conf, can you change settings with .htaccess? If so, then this problem can be solved with mod_rewrite.
posted by justkevin at 10:39 AM on March 22, 2006


Assuming that apache is configured correctly, you can use a RedirectMatch directive in .htaccess

Something like:
RedirectMatch /baz/(.*)$ http://new.domain.com/$1
posted by rajbot at 10:50 AM on March 22, 2006


Response by poster: Thanks, I will try both these methods today and note what happens. I don't know offhand if our main domain host permits .htaccess.
posted by mwhybark at 11:02 AM on March 22, 2006


Just a note. Even if a host gives you .htaccess support, they may not let you put mod_rewrite or mod_alias rules there (though many do).

Another other option would be to create a bunch of dummy HTML pages to replace the originals that use a meta redirect to the new location. Not all that complicated, but I don't know of any ready-made scripts to do it for you.
posted by Good Brain at 11:10 AM on March 22, 2006


Response by poster: nope, .htaccess is disallowed. Shoot.
posted by mwhybark at 11:29 AM on March 22, 2006


Response by poster: Oh, hilarity. I just realized we already have DNS forwarding set up; the commercial aggregator renders their pages into frames which led me to overlook just testing to see if forwarding was already in place.

I'm placing a pancake on my head at this very moment.
posted by mwhybark at 11:39 AM on March 22, 2006


I'm placing a pancake on my head at this very moment.
What's the story behind that phrase?
posted by chazlarson at 12:06 PM on March 22, 2006


Response by poster: See this as a starter.
posted by mwhybark at 7:20 PM on March 22, 2006


« Older Carbondale 101   |   Mad about the mouse Newer »
This thread is closed to new comments.