r00t.gr

Programming and more

Entries Tagged ‘apache’

nginx, apache reverse proxy, and $_SERVER[‘HTTP_HOST’]

Ok here is the senario: I have a website built on a server with nginx as the main web server I use apache as a reverse proxy The problem: I tried to use the $_SERVER[‘HTTP_HOST’] command (this gives you the hostname of the url the user requested). For example if the user requested http://subdomain.domain.net/ $_SERVER[‘HTTP_HOST’] […]

How to redirect all non www traffic to www

I found that it is usually a good idea, to redirect all trafic that doesn’t have www infront of the domain to www.domain.com. I explain how to do it with apache mod_rewrite in the end of the post, scroll there if you just need the answer. Let’s say, a user types http://domain.com he should redirect […]