user5311126
user5311126

Reputation:

Working with subdomain

I have few questions regarding subdomains in my mind. I know how to get a subdomain and redirect to it using .htaccess or placing js file in our directory.

My questions are:

  1. Suppose I have a website www.mysite.com and I want to redirect mobile users to m.mysite.com. Can I place js file with redirecting code anywhere in the directory or should it be in specific path?
  2. I want different functioning and styling for mobile users for which I have to write a separate code. Where will I place this mobile friendly code and link it to redirecting code? I don't want to use any app or web service for this.

Upvotes: 2

Views: 71

Answers (1)

sitilge
sitilge

Reputation: 3737

Suppose I have a website www.mysite.com and I want to redirect mobile users to m.mysite.com.

This could save your day: What is the best way to detect a mobile device in jQuery?

Can I place js file with redirecting code anywhere in the directory or should it be in specific path?

It doesn't depend where you put the .js file, you have to include it in the respective file.

<script src="path/to/file.js"></script>

Upvotes: 1

Related Questions