How to force www prefix in PHP and Asp.Net

How to prefix WWW to URL in PHP and ASP.NET

It is quite important to understand difference between URL prefixed with www and without www.

There seems to be not much difference in those as both represent same URL but this can be pain while coding some if its a bad day. It also make a difference in case of SEO and better to have uniformity in all URLs of website.

If you have adedicated server with IIS, its quite easy to force website to have each URL prefixed with www but in case of shared hosting you may be required to make some addition in code to acheive this. Here is a code snippet to force URL to prefix www in asp.net:
Continue reading