How do I redirect/rewrite to the FQDN URL without setting ServerName?

Posted by ChaimKut on Server Fault See other posts from Server Fault or by ChaimKut
Published on 2013-11-13T13:41:44Z Indexed on 2013/11/13 15:59 UTC
Read the original article Hit count: 297

Filed under:
|
|
|
|

Often in intranets, users will direct URLs to a hostname without supplying the FQDN. Example:

http://internalHost

Instead of

http://internalHost.example.com

I would like to redirect users / rewrite URLs so that everything will use the FQDN. Here's the catch: I don't want to set ServerName explicitly. (This is for a product which will be deployed in multiple intranets so we can't know the value of ServerName ahead of time).

According to: http://wiki.apache.org/httpd/CouldNotDetermineServerName Apache uses a reverse lookup to determine a default FQDN.

How can I make use of/reference that FQDN that Apache is using for a mod_rewrite or redirect?

© Server Fault or respective owner

Related posts about apache2

Related posts about mod-rewrite