Home  >  Q&A  >  body text

How Apache rewrites requests to the specified wap page directory based on UA ​​(User-Agent)

Brothers, I have a requirement like this: I have a website and access the Web page through www.website.com, but I want to make a corresponding Wap page for the corresponding Web page to simplify and improve the mobile terminal. The user’s experience of visiting this page and adapting the page can then be accessed through m.website.com. We need to give our page URL to our partners in certain scenarios. We hope to redirect www.website.com The link is given to the partner until the user accesses the mobile user based on the client's UA (User-Agent) and rewrites to the page corresponding to m.website.com, so please tell me how to rewrite based on the UA in Apache. ? And how do you distinguish between so many UAs and whether they are mobile (http://www.user-agents.org/)?

漂亮男人漂亮男人2714 days ago554

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-05-16 17:06:47

    What is the Web field without pioneers? Reference: http://detectmobilebrowsers.com/, the first item in alphabetical order, Apache

    reply
    0
  • 高洛峰

    高洛峰2017-05-16 17:06:47

    UA Although this method can also be implemented, UA is often not accurate. There are so many browsers now, and new ones pop up every day, which causes a heavy workload for subsequent maintenance of UA, so it is more recommended to use the method of judging the resolution size. way to achieve it. For example, use javascript to judge

    There is also an improvement based on the existing website, which is Media Queries using CSS3

    对于
    @media only screen and (max-width: 767px) {
        /* 分辨率小于 767px 时的样式 */
    }

    Example reference http://webdesignerwall.com/tutorials/...

    reply
    0
  • Cancelreply