I've got a site example.com and the other one test.example.com. Have different configuration file. However when I enter url test.example.com it redirects to example.com.

configuration file for instance.com

 <VirtualHost *:80>

  ServerName  example.com

  ServerAlias world wide web.example.com

  DirectoryIndex index.html

  DocumentRoot example-document-path

  Options -Indexes

  ErrorDocument 404 /errors/404.html

  ErrorDocument 403 /errors/404.html

 <Location "/">

    SetHandler python-program

    PythonHandler django.core.handlers.modpython

    PythonPath "['path', 'path'] + sys.path"

    SetEnv DJANGO_Configurations_MODULE example.configurations

    PythonInterpreter example

    PythonAutoReload On

    PythonDebug On

  </Location>

</VirtualHost>

Apache configuration apply for test.example.com

<VirtualHost *:80>

  ServerName  test.example.com

  ServerAlias world wide web.test.example.com

  DirectoryIndex index.html

  DocumentRoot test-example-document-path

  Options -Indexes

  ErrorDocument 404 /errors/404.html

  ErrorDocument 403 /errors/404.html

 <Location "/foo/bar/">

    SetHandler python-program

    PythonHandler django.core.handlers.modpython

    PythonPath "['path', 'path'] + sys.path"

    SetEnv DJANGO_Configurations_MODULE example.configurations

    PythonInterpreter example

    PythonAutoReload On

    PythonDebug On

  </Location>

</VirtualHost>

The main url test.example.com redirects to example.com which i'm not going? The way i have no idea? Can anybody please suggest something?

Thanks ahead of time.

First guess could be cache problem, second guess could be your index.html (or .php or whatever) file on test.example.com. When not either of individuals, run:

$ curl -vvv test.example.com

And find out what headers its delivering back. They provides you with some clues concerning the character from the redirect. In the event that does not solve it, publish the output here.

Edit: Okay, if you are obtaining a 302 from Apache, there's merely a small group of products that may be responsible. Things that spring to mind are:

  • .htaccess file within the test.example.com root
  • Redirect and Alias directives in Apache config (egrep -R 'RedirectAlias' /etc/apache2/)
  • ModRewrite rules with redirects (egrep -R 'bRb' /etc/apache2/)

Also, verify that you are really speaking towards the server you anticipate to become speaking to (eg, curl http://test.example.com/blahblahblah, then grep the access log for blahblahblah).