0

I installed a LAMP server and set up my domain name to resolve to an appropriate IP address. However, when I connect to a server with it's domain name, it is with an IP address in an address bar. My /etc/apache2/sites-available/default looks like this:

NameVirtualHost *:80

<VirtualHost *:80>
        ServerAdmin ...
        ServerName mydomainname.irrelevant.to.the.question

        DocumentRoot /var/www
...

I thought that was supposed to fix this behaviour. What else is required?

Septagram
  • 937
  • 1
  • 8
  • 13
  • Sounds like you have some 3xx redirect somewhere. Please check your Redirect/RedirectMatch/RewriteRule directives. – LazyOne Sep 02 '11 at 11:15

1 Answers1

1

It's likely your PHP application.

Apache won't bother with this kind of redirection without being specifically told to with a Redirect or RewriteRule doing it (it doesn't "enforce" matching of the ServerName in any way), but a lot of web applications out there in the world like for the requested hostname to match what they're internally configured with.

Shane Madden
  • 114,520
  • 13
  • 181
  • 251
  • actually, server does this thing even when it's not in the application's sphere of influence. Specifically, application in question is redmine, it's accessible under (in example) http://server.address/redmine, but the address string is replaced both if we go to http://server.address/redmine and http://server.address (where a stock apache "It works!" is displayed for now). – Septagram Sep 03 '11 at 08:19