Subdomain vs subdirectories


#1

I know the differences between those two, but I’d like to know if there is some reasons to pick up one instead of the other. Maybe users prefer to type me.xxx.com instead of www.xxx.com/me ?
I don’t understand why people prefer to mess up with dns (and wait) instead of simply create a subdir. Am I missing something?
One reason to use subdomain is that you don’t have to put things on the same directory of your domain.


#2

Well, I wouldn’t necessarily say your are “missing” anything, but there are some reasons why using a full sub-domain might be a better plan than using a sub-directory.

  1. If you need different environments for applications (PHP4 for one program, and PHP5 for another).

  2. To simplify .htaccess based apache re-write rules and avoid potential conflicts.

  3. To establish different email address systems (admin@blogs.yourdomain.tld and admin@gallery.yourdomain.tld)

  4. to keep separate versions of content (dev.yourdoman.tld, old.yourdomain.tld, etc.)

I’m sure there are likely others also; these are the things that generally impact my decision to use a subdomain.

–rlparker


#3

Ok, this makes sense.
Maybe I don’t get point nr.2. I thought rewrite rules where not recursive, so you shouldn’t have any problem even if you are using directories instead of domains.


#4

I didn’t really word that “item 2” very well; .htaccess files impact the directory in which they are placed, *and all directories beneath that directory *in the filesystem directory tree unless modified by an .htaccess file in that directory, and so on).

Re-write rules are one component of many .htaccess files, but not the only one, and other .htaccess based directives that can produce unintended / undesirable results remain an issue. For many, it is just simpler to separate the directory trees.

One other thing to consider is that with many hosting companies (in the past, the great majority of hosting companies, each “sub-domain” set up the way DH does it counted as a “hosted domain” and cost money. This probably contributed to many users going the "sub-directory route instead of using a “sub-domain” DH style. HEre, it costs nothing extra! :slight_smile:

–rlparker