# How to default to latest on mobile and categories+latest on desktop?

**URL:** <https://meta.discourse.org/t/how-to-default-to-latest-on-mobile-and-categories-latest-on-desktop/55716>\
**Category:** Support\
**Created:** [2017年一月13日 18:09 UTC](https://meta.discourse.org/t/how-to-default-to-latest-on-mobile-and-categories-latest-on-desktop/55716 "2017-01-13T18:09:51Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Lutz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lutz/32/65103_2.png) [@Lutz](https://meta.discourse.org/u/Lutz)\
**Post date:** [2017年一月14日 12:43 UTC](https://meta.discourse.org/t/how-to-default-to-latest-on-mobile-and-categories-latest-on-desktop/55716/4 "2017-01-14T12:43:02Z")

</div>

You could do it, if you edit the nginx-settings. We use a nginx reverse proxy, so its no real problem. Its a dirty hack, but works.

```plaintext
    # ---------------------------------------------------------------------------------
    # Redirect Mobile to latest instead to default
    # ---------------------------------------------------------------------------------
        set $mobile_rewrite N;
        if ($http_user_agent ~* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") {
               set $mobile_rewrite Y;
        }
        if ( $http_referer !~* "www\.mydomain\.com" ) {
               set $mobile "${mobile_rewrite}E";
        }
        if ($mobile_rewrite = YE) {
               rewrite ^\/$ https://www.mydomain.com/latest redirect;
        }
        if ($http_user_agent ~* '(iPhone|iPod|android|blackberry)') {
             rewrite ^\/$ https://www.mydomain.com/latest permanent;
        }
```

  
This version is shorter and faster, may also work for you. [code] if ($http\_user\_agent ~\* "(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino") { rewrite ^\/$ https://www.mydomain.com/latest redirect; } [/code]

---

_[View the full topic](https://meta.discourse.org/t/how-to-default-to-latest-on-mobile-and-categories-latest-on-desktop/55716)._
