Please bear with me while I try to explain some htaccess gymnastics I'd like to perform.
I have this domain: eamorr.somesite.com
, at 192.168.100.100.
It is serving pages from my public_html
folder as expected.
Now, I want to use the following address:
www.somesite.com/eamorr
I do not have control over www.somesite.com
(192.168.99.99), however my sysadmin has allowed me to place a .htaccess
file in the eamorr
folder. I am not allowed, under any circumstances, to place anything else in the eamorr
folder for reasons I do not know.
What I want to happen is this:
User navigates to www.somesite.com/eamorr/some_page.php
User is fed some_page.php
from eamorr.somesite.com/some_page.php
(i.e. 192.168.100.100/some_page.php).
I'd like this to be as seamless as possible -- i.e. when a user navigates to http://www.somesite.com/eamorr/some_page.php they get served some_page.php and are oblivious to the fact that some_page is coming from a different server (192.168.100.100)
http://www.somesite.com/eamorr should be in the address bar of the user's browser at all times and not http://eamorr.somesite.com -- my boss "just wants it that way"...
Is this possible to do using .htaccess
?
It sounds like what you want is what is called a "reverse proxy", and it's a job for Apache's
mod_proxy
. However, you can't set this up in a.htaccess
file -- it has to be done in a different context. Perhaps someone here knows better, but I don't think what you're asking for will be possible with a single.htaccess
file alone.Use Apache
mod_proxy
to point to another server. Apache docs here.This worked well:
But only after the proxy modules were loaded correctly:
Notes
*.example.com
.Disallow: /
to myblog.example.com/robots.txt
. Like this search engines will not start indexing in two locations. And search engines will simply ignoreblog/robots.txt
.