Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Sounds like you have some 3xx redirect somewhere. Please check your Redirect/RedirectMatch/RewriteRule directives. –  LazyOne Sep 2 '11 at 11:15

1 Answer 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.

share|improve this answer
    
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) server.address/redmine, but the address string is replaced both if we go to server.address/redmine and server.address (where a stock apache "It works!" is displayed for now). –  Septagram Sep 3 '11 at 8:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.