i've got a site like twitter.com on server one as well as on server two i've forum, which path is much like domain.com/forum
on server one i needed to implement wild card dns and set primary domain onto it. but on server two i needed to help keep forum separate, i cant give sub-domain forum.domain.com, because its links happen to be place in search engines like google and link to domain.com/forum.
so i'm wondering, how do i put domain and wild card dns on server one but still capable of giving path on server 2 for domain.com/forum (as sub-folder).
do you consider htaccess can perform that job? if so, then how?
You could utilize htaccess and mod_rewrite so domain.com/forum really shows pages from forum.domain.com.
Maybe something similar to this:
Options +FollowSymLinks RewriteEngine on RewriteRule domain.com/forum/(.+) forum.domain.com/$1
Easy - make use of a proxy! If you want apache you'll love apache mod_proxy for the purpose.
<VirtualHost *:80> ServerName maindomain.com ServerAlias *.maindomain.com # insert document root and general settings for this domain here # ... ProxyPass /forum http://forumdomain.com ProxyPassReverse /forum http://forumdomain.com ProxyPassReverseCookieDomain forumdomain.com maindomain.com </VirtualHost>
This configuration makes apache perform a HTTP-request for your internal domain (forumdomain.com) without notifiying the customers browser from the internal location. Your Forum is going to be accessable at http://*.yourdomain.com/forum. Snacks and headers the forum sents can get rewritten accordingly and check-engines won't take serious notice of the after sales-server.
Read much more about it at http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
Should you have to rewrite reference sin your html (href, src ...) you may google on "mod_proxy_html".
An answer such as this could obviously be build along with other intelligent proxyservers like squid too. Technology-not only to map any content from "after sales servers" for your public domain. Make certain routing is alright or setup a number-entry for the internal domain (forumdomain) having a internet ip-addresse 192.168 ...
Enjoy your website and provide feedback how exercised :)
p.s.: a "RewriteRule" directive could possibly perform the same factor for you personally however the rdirect is going to be visible (and performed) through the client unless of course you specify the "P", foricng it to complete an interior proxy request. If available I'd like the mod_proxy though because it is handier and enables for additional configuration.
Use a 301 redirect to make certain the internet search engine update their index together with your new web addresses like so:
RewriteRule domain.com/forum/(.*) http://forum.domain.com/$1 [R=301,L]
If you have two servers you do not genuinely have many options but to utilize a redirect (ideally a 301 Permanent redirect) to maneuver customers from
The only real other method of doing it might be to place a reverse proxy before individuals two servers, which reads the URL and internally directs the query right server, but that is then an additional bit of hardware.
If you are using a proxy on server 1 pointing to server2, you will raise the strain on server 1, since all traffic is going to be routed through it. Besides, if server 1 goes lower, nobody will have the ability to achieve server 2 either. Obviously it's possible though, however these things should be considered.
I recommend establishing a supdomain for server 2 anyway, like forum.domain.com, as well as on server 1 you place up a 301 redirect from domain.com/forum to forum.domain.com using mod_rewrite from htaccess. By using their technique, you may also redirect calls to a particular links for their corresponding page on server 2. Search engines like google follows the 301 and they'll eventually update the index.