Force Canonical Hostnames in Web Server
Thursday Jul 05, 2007
People like to use the short hostnames to access a web server, eg, http://agc163/ or http://agc163.prc/. It would be better that apache (httpd) can re-direct this request to a canonical hostname, thus we can force the use of canonical hostnames. Code snippet in httpd.conf:
RewriteEngine on Options +FollowSymLinks RewriteCond %{HTTP_HOST} !^agc163\.prc\.sun\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/(.*) http://agc163.prc.sun.com/$1 [L,R]
Reference: http://httpd.apache.org/docs/1.3/misc/rewriteguide.html












http://yaplog.jp/1000-fx/