Forum Moderators: phranque

Message Too Old, No Replies

subdomains and trailing slashes. cant figure it out

         

Gateway

8:15 pm on Nov 18, 2005 (gmt 0)

10+ Year Member



We are working on some software that allows a admin to a subdomain .. so an admin can add in via a php script blah.mysite.com

we currently have this in a development area on our site

www.mysite.com/development/

so when the subdomain is currently added to test it you have to go to blah.mydomain.com/development/ to see your page.

The issue is now when if you dont put a '/' after development example:

blah.mysite.com/development <--- missing /

apache seems to redirect us back to our site

www.mysite.com/

so unless a user puts in the / at the end of their subdomain it wont go to their section and redirect them to www.mysite.com

we arnt using htaccess for any of this and prefer not to since we have php code handling the subdomain creation.

our virtual host in apache settings for this site are

<VirtualHost x.x.x.x >
ServerAdmin webmaster@mysite.com
Servername www.mysite.com
ServerAlias *.mysite.com
CustomLog /usr/local/apache/logs/www.mysite.com-access.log sagi
#ErrorDocument 404 [mysite.com...]
ServerAlias *mysite.com
Documentroot /usr/home/http/mysite/
</VirtualHost>

so my question is how to resolve this, is this a apache config issue, how the dns handles subdomains, ie catch all domains..?

any thoughts?

jdMorgan

9:11 pm on Nov 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



DNS doesn't care about trailing slashes -- only the subdomain, second-level-domain, and top-level domain -- That is, blah, mysite, and com in your example. If the subdomain requests are working at all, then DNS is not the issue.

Check your server config, though. I suggest trying the following settings:

Options -MultiViews
UseCanonicalName off

If you have Options [httpd.apache.org] MultiViews enabled or make a request to the server without a trailing slash, then the server will first try to resolve the request as a file request. Failing that, Apache mod_dir [httpd.apache.org] will append a trailing slash, so the request can be re-tried as a directory request. If UseCanonicalName [httpd.apache.org] is on, then the canonical ServerName will be used instead of the original client-requested hostname, and the result will be a redirect to your canonical (main) domain.

Jim

Gateway

9:42 pm on Nov 18, 2005 (gmt 0)

10+ Year Member



thanks that seem to do the trick..