Domain doesn't work without `www`

前端 未结 6 1041
隐瞒了意图╮
隐瞒了意图╮ 2020-12-14 07:31

When I type in my domain name like without the www (like http://example.com), it doesn\'t work and gives error message. However, when I add the

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-14 07:56

    You need to change any full urls to paths. If your php include or other processes are linked using urls, it will only work one way.

    $.ajax(
    {       
        url:'/LAYOUT/process.php'
    }
    

    as oppose to the full url

    $.ajax(
    {       
        url:'https://www.yourdomain.com/LAYOUT/process.php'
    }
    

    Using a simple path will allow it to work both ways with or without www.

提交回复
热议问题