0

I am trying to create url like subdomain without creating subdomain in cpanel.

My current url:

http://colleges.com/

When it's opened using a mobile device it should become:

http://m.colleges.com/

Is it possible to do using javascript or jquery?

How to achieve this?

Jasper de Vries
  • 19,370
  • 6
  • 64
  • 102
Racheal
  • 21
  • 1
  • 7
  • `RewriteCond %{HTTP_HOST} ^mysite.com$ [NC] RewriteRule ^(.+)$ http://$1.mysite.com [L,R=301]` – Daan Aug 26 '14 at 10:20
  • 1
    See: http://stackoverflow.com/questions/183928/how-to-let-php-to-create-subdomain-automatically-for-each-user – Kohjah Breese Aug 26 '14 at 10:20
  • N.B. You cannot do this in PHP, or JS. – Kohjah Breese Aug 26 '14 at 10:20
  • I have googled for the last 2 days, but didn't find any good details and applied lots of codes. can you please provide me any good link or code snippet. – Racheal Aug 26 '14 at 10:22
  • Yes is is possible with `JS` even with `PHP`. lacks research i googled "detect mobile in js and php" and the answer was already there – tomexsans Aug 26 '14 at 10:23
  • How to do it in PHP ???? – Racheal Aug 26 '14 at 10:24
  • You could use http://mobiledetect.net/ to perform server-side redirections. Client-side redirections could be done based on a simple regex matching on the user agent. But anyway, you need to first make a mobile version by `http://m.colleges.com/`. – aymericbeaumet Aug 26 '14 at 10:26
  • I want to use same project for both http://m.colleges.com/ and http://colleges.com – Racheal Aug 26 '14 at 10:28

0 Answers0