[removed] with hash part (anchor) #

前端 未结 8 533
迷失自我
迷失自我 2020-12-28 15:46

One of our website has URL like this : example.oursite.com. We decided to move our site with an URL like this www.oursite.com/example. To do this,

8条回答
  •  悲哀的现实
    2020-12-28 16:29

    When returning status 301, your server is supposed to return a 'Location:' header which points to the new location. In practice, the way this is implemented varies; some servers provide the full URL (netloc and path), some just provide the new path and expect the browser to look for that path on the original netloc. It sounds like your rewrite rule is stripping the path.

    An easy way to see what the returned Location header is, in the python shell:

    >>> import httplib
    >>> conn = httplib.HTTPConnection('exemple.oursite.com')
    >>> conn.request('HEAD', '/')
    >>> res = conn.getresponse()
    >>> print res.getheader('location')
    

    I'm afraid I don't know enough about mod_rewrite to tell you how to do the rewrite rule correctly, but this should give you an idea of what your server is actually telling clients to do.

提交回复
热议问题