Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between http://example.com and http://www.example.com

I getting a exception to retrieve session value in following condition.

  1. if I open site with this link http://example.com and assign session value
  2. Page will be redirect to the another site http://example1.com.
  3. some action at http://example1.com
  4. redirect to http://www.example.com (not http://example.com) and retrieve session value

in this situation system throw exception... but if i open site with http://www.example.com then working fine.

I have some questions

  1. Difference between http://example.com and http://www.example.com?
  2. how can resolve that problem because it is not necessary that user will type http://www.example.com.
like image 316
Govind Malviya Avatar asked Jan 29 '26 23:01

Govind Malviya


2 Answers

Putting it very simply, http://site.com and http://www.site.com are two separate sites. This is because of the way DNS is setup for a domain name. You can configure the DNS record for a domain name to point both at the same IP address, or you could use a URLRewrite rule to force traffic one way or the other.

Take a look at this for more info:

Specify a canonical domain name for your site with IIS 7

like image 132
Ira Rainey Avatar answered Feb 01 '26 18:02

Ira Rainey


In the past many host servers created websites as subdomains under www., following THEN-current naming conventions.

We no longer need to do this.

There are no technical differences you will come across.

What matters is :

  1. You should stick with any one (say example.com), for better SEO rankings.
  2. Make sure the other site (that is www.example.com) points to example.com


This can be done by:

  1. CNAME is the DNS tag that maps an alias to the main name in the DNS record: in this case the "www." version of the name. With this solution surfers could include or exclude www. and reach the site either way.

    • http://www.wisegeek.com/what-is-the-difference-between-a-website-with-a-www-and-without.htm
  2. Making changes in the .htaccess file. Few links for reference:

    • https://theindexer.wordpress.com/2009/02/12/redirect-all-users-to-access-your-site-withwithout-www-prefix/
like image 31
user2333811 Avatar answered Feb 01 '26 16:02

user2333811



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!