Remove WWW prefix from your website

前端 未结 9 684
情歌与酒
情歌与酒 2020-12-28 19:24

How does Stack Overflow (and other web sites) remove the \'www\' prefix when it\'s entered as part of a URL?

Is it a redirect, a rewrite or something else entirely?<

9条回答
  •  一个人的身影
    2020-12-28 20:16

    You need a default dns entry added pointing to your web server.

    ping site.com and verify ip is pointing to webserver, if not you need to get the default DNS entry added.

    for a basic setup:

    You'll have to add host headers http://www.visualwin.com/host-header/

    Create 1 site with a hostheader of www.site.com

    In the Home Directory tab, set it to a permanent redirect to http://site.com

    Create a 2nd site with a host header of site.com

    If you want www.site.com/file.html to redirect to site.com/file.html you will need a more advanced setup with something like ISAPI_Rewrite or use custom 404 pages to do it.

提交回复
热议问题