[UPHPU] load-balanced 301 redirects

Jim Anderson jim.anderson at techiegroup.com
Mon Mar 31 10:11:47 MDT 2008


on way to gp about it would be to sniff the http_host and then base a 
constant [or variable] upon the sniff.

here's an example of something i have done in the past that allowed me 
to have what you are asking for:


if (!stristr($_SERVER['HTTP_HOST'], 'unmannedship.com')) {
    // development area
    define('BASE_URL', 'http://localhost/www.unmannedship.com/');
} else {
    // live site
    define('BASE_URL', 'http://www.unmannedship.com/');
}

-thinbegin



Wade Preston Shearer wrote:
> Because a site is load-balanced between multiple servers, I have had 
> to use a full URL ("http://example.com/…" instead of just "/…") for 
> 301 mod_rewrite redirects. The problem with this is that the same code 
> then does not work in the development environment. Does anyone have a 
> solution for this? A way that I can have the same code work in both 
> places? I would prefer to not have the domain in the redirect path, 
> but can't think of any other way for it to work with the 
> load-balancer. Any ideas?
>
>
> wade
> ------------------------------------------------------------------------
>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net


More information about the UPHPU mailing list