sean
sean

Reputation:

Use subdomain name in my PHP code?

First of all, what's the difference between:

www.domain.com

and

domain.com

Should I pay attention to this when I do the coding?

Upvotes: 0

Views: 138

Answers (3)

Chris
Chris

Reputation: 9509

I would highly recommend to use relative paths.

This has many advantages, for instance:

  • Paths are shorter
  • If you want to move to a different domainname you don't have to check through thousands of codelines

In general there IS a difference between: www.domain.com and domain.com. The "www" prefix is nothing more than an ordinary subdomain: http://en.wikipedia.org/wiki/Subdomain

Upvotes: 5

Mike Stanford
Mike Stanford

Reputation:

Relative urls arnt the best idea. its a good idea to have one constant hold the value for a relative url and the rest to be static

Upvotes: 0

Richard Stelling
Richard Stelling

Reputation: 25665

domain.com

Is the registered domain and

www.domain.com

Is a sub-domain of domain.com, they are not alway the same. Most web sites will set up their webserver to redirect domain.com to www.doamin.com or vice versa.

Depending on the DNS Zone file configuration sub-domains can point to different IP addresses (possibly different physical servers).

example.com.  A     10.0.0.1              ; ip address for "example.com"
ns            A     10.0.0.2              ; ip address for "ns.example.com"
www           CNAME ns                    ; "www.example.com" is an alias for   "ns.example.com"
wwwtest       CNAME www                   ; "wwwtest.example.com" is another alias for "www.example.com"
mail          A     10.0.0.3              ; ip address for "mail.example.com", any MX record host must be

Taken form Wikipedia - DNS Zone File

Upvotes: 3

Related Questions