vhost

Apache force www subdomain

A redirect in an apache vhost to force the website to www.$domain.tld <VirtualHost *:80> ... RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=302,L] # test and reload apachectl -t && apachectl -k graceful

Keep nginx from pushing backend port on try and redirects

Ever found yourself wondering why your nginx setup is returning a port from the backend vhost? QUICK FIX: port_in_redirect off; I found some tweaks to prevent this from happening, first a example: # This is the result of a: try $uri $uri/ in a backend vhost stein@stein ~ $ curl --head http://www.example.nl/test HTTP/1.1 301 Moved Permanently Server: nginx Content-Type: text/html Content-Length: 178 Connection: keep-alive Location: http://www.example.nl:8080/test/ Accept-Ranges: bytes X-Varnish: 1044342160 Age: 0 Via: 1.