rewrite URL with respect to request domain in apache

0

I want to serve different files when user calls a URL from different domains. For instance, I have a desktop version and mobile version of the website. I want to serve a specific file when user access mobile url and desktop url.

Please dont say about virtualhost concept. I cant use virtualhosts here because of some reason. This apache will server both mobile and desktop version of the url with single instance.

My requirement is like

http://dev.domain.com/sub-domain/file ---> this should serve desktop version file, say /var/www/html/desktop.txt

http://m-dev.domain.com/sub-domain/file, this should server the mobile version file, say /var/www/html/mobile.txt

Please help me with some rewrite rules. I want some rule which will detect the request url and redirect to file name

Unnikrishnan

Posted 2017-03-17T13:10:46.543

Reputation: 1 193

XY problem. You should be using responsive design. – DavidPostill – 2017-03-17T13:26:51.317

Can u plz explain ? im just searching a rewrite rule – Unnikrishnan – 2017-03-19T07:10:58.487

No answers