0

I want to set up dynamic html serving on my apache server. It means that for different types of devices (mobile, tablet, desktop) content should be different, while url stays the same.

For example:

  1. From desktop www.example.com/index.html

    Completely different layout

  2. From mobile device www.example.com/index.html

    Completely different layout

How to achieve this? What would be apache configuration?

I don't want to use RWD because layout between devices differs too much.

zofia
  • 23
  • 5
  • 1
    Is it the layout that's different, or the content that's actually different? Difference in layout ("responsive design") is usually achieved via mediaqueries in the css, not on the webserver. – Buurman Jul 28 '15 at 10:29
  • Content also differs – zofia Jul 28 '15 at 10:34
  • Probably you could achieve this with some intelligent `htaccess` rewrite rules. – Tate83 Jul 29 '15 at 08:24

1 Answers1

-2

I'm not familiar enough with Apache to say this definitively but I don't think you can actually serve different webpages on the same url without some sort of server side page generation (such as a web application framework).

However, if you have a normal site on www.example.com and a mobile-friendly site on m.example.com you can configure Apache to redirect users of a mobile device to your mobile site.

Google "Apache detect mobile device" and you see links such as http://blog.justin.kelly.org.au/apache-mobile-device-detection/ which seems to do pretty much exactly that.

One warning is in order: the detection is based on the user agent string and is therefore comprised of fuzzy logic; some user agents (some devices) might not be detected correctly. I would therefore advise you to also have a link at the top of your 'normal' webpage to users can click to get to your 'mobile' webpage.

Buurman
  • 1,914
  • 17
  • 26