One domain two web hosts

Using a single web hosting account to host multiple sites

One domain two web hosts

Postby stask » Wed Sep 19, 2007 2:25 pm

I've got domain example.com on webhost1. All filenames there have/require a .html extension.

I want to move over to a wiki-like webhost2 where all filenames have no extension. No extensions allowed.

Not much control at webhost2, lots at webhost1. Can I do something where for instance, http://www.example.com/test.html (at webhost1) can be sent to http://www.example.com/test (at webhost2) AND have the browser address read as http://www.example.com/test ...and stay that way as they navigate on webhost2?...not losing the (example.com) domain name I mean...

(Would DNS records need changing too?)

I have incoming links to webhost1 that have a .html extension and I'd like those to appear at webhost2 without causing a 404 error and hopefully showing in the browser address, the new "correct" address of http://www.example.com/test

I would keep no html files on webhost1 only use it to redirect to webhost2.

Seems like there must be a way to drop a visitor at webhost1 and then use something at webhost1 to send them on properly to the correct file at webhost2 without incident. :-?

I barely understand DNS, and mod_rewrite--I'm just looking into today. So any help would be appreciated.

Thanks.
stask
 
Posts: 4
Joined: Wed Sep 19, 2007 1:44 pm

Postby richardk » Thu Sep 20, 2007 1:14 pm

Do you only have one domain? How are you accessing the webhost2? If you were to change the DNS for your domain to go to webhost2, you would have to rewrite on webhost2.

You could remove the extension (with the user knowing or not) and proxy the request from webhost1 to webhost2 but that would use twice the transfer as the request gets transferred from your to webhost1 then proxied to webhost2, then the response (html) gets sent to webhost1 and finally to you.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby stask » Fri Sep 21, 2007 10:12 am

Yes, 1 domain.

1. I don't want to break (404) any old incoming (external) links to current webhost1 (which are all .html) by my moving to webhost2.

2. I want to use the simple content management system of webhost2 but they control the server and do not allow .html files, or much of anything relating to server control.

Since I'm paying for both hosts and traffic is not high, transfer isn't a problem unless it slows page delivery down too much.

I just wonder if there is a way to do this. Otherwise, I guess the links just break when I go totally with webhost2.

Again I'm trying to use an easier page management system (webhost2) AND not break any old incoming links (that currently go to webhost1 from other sites on the internet that I do not control).

I'm all eyes and ears if there is way to do this.

Help save the links! :)

Thanks for your reply.
stask
 
Posts: 4
Joined: Wed Sep 19, 2007 1:44 pm

Postby richardk » Fri Sep 21, 2007 1:37 pm

How do you access webhost2? The below example uses you.webhost2.com.

To visibly remove the .html (probably better so you can move to webhost2 in the future), try the following in a .htaccess file in webhost1
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Remove .html
RewriteRule ^(.+)\.html$ /$1 [R=301,L]

# Proxy to webhost2
RewriteRule ^(.+)$ http://you.webhost2.com/$1 [P,L]


Or to leave .html in the address bar, try the following in a .htaccess file in webhost1
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Proxy to webhost2
RewriteRule ^(.+)\.html$ http://you.webhost2.com/$1 [P,L]
RewriteRule ^(.+)$       http://you.webhost2.com/$1 [P,L]


Both of these mod_rewrites require mod_proxy to be enabled on webhost1 too.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby stask » Fri Sep 21, 2007 7:54 pm

Thank you very much. I've apparently come to the right place. I love it when only a few lines of code can do something several people said can't be done!

I will try this code on webhost1 as I believe I have "full" access there, have to check for mod_proxy though.

webhost2 access, I'm not sure what you mean by that, but if it is http://myname.theirdomain.com, then yes, that's how they run it...unless you use what they call a custom domain which allows CNAME's only. I could use an A record but they won't guarantee the IP address will always remain the same and have no means of notifying a change. Therefore, they "support" CNAME's only.

As far as accessing webhost2 for anything that I might make into a page, it's kind of like using Google's blogger, fill in the blanks on web pages. You can't get inside the system, but it works quite well for what it does, producing pages easily. It's a one-of-a-kind system that has been written over 4 years I think.

webhost1 is a "standard" multi-domain web host with nearly all the bells and whistles. I will let you know how this works out.

If you are interested in the webhost's business names I will be happy to tell you, I just didn't want to clutter things up with that.

Many thanks again.
stask
 
Posts: 4
Joined: Wed Sep 19, 2007 1:44 pm

Postby stask » Fri Sep 21, 2007 8:57 pm

Just tried a test. Hee hee works great!!!! Amazing. :)

Thanks again.
stask
 
Posts: 4
Joined: Wed Sep 19, 2007 1:44 pm


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 5 guests

cron