ashleigh
ashleigh

Reputation: 37

redirecting site to mobile...file name?

This is my first time creating a mobile site for someone I have the javascript code all set up and when tested on my phone, it redirects it to: m.websitename.com, like I want it to. However, I have no idea what to name the file I am wanting it to redirect to? I saved the file under: mobile.html, but it isn't redirecting to it.

I don't want it to redirect saying www.websitename.com/mobile, I don't think it looks as professional.

Thanks

Upvotes: 0

Views: 197

Answers (3)

kiranvj
kiranvj

Reputation: 34137

You can have any filename you like. But as btevfik mentioned either put index.html or default.html

I recommend index.html

Also you can set the default file in you server configuration. By default most servers have the default file handler as index.html. For Apache it will be either index.html or index.php. You can change this to something like mobile-handler.html by changing the server configuration.

So whenever you access your site by http://your-site.com or m.your-site.com the default file specified in the server configuration is loaded.

Please note that your-site.com and m.your-site.com will have different site root, hence request will be handled by difffernt files.

Upvotes: 0

Jason
Jason

Reputation: 1309

You would probably want to do this using subdomain and destination setup from your server you are using (Most of webhosting companies made this easy through their software e.g. cPanel). Directory structures is going to look like this. So when user was redirected t m.yourweb.com/ then it's not going to have m.yourweb.com/mobie.

domain [directory]
      css [directory]
      js  [directory]
      index.jsp  [file]
      purchase.jsp  [file]
      ...

      subdomain [directory] <- for mobile
        css [directory]
        js  [directory]
        index.jsp  [file]
        purchase.jsp  [file]

So when mobile user was detected, JS is going to redirect this user to the subdomain (for mobile) instead of normal directory. The other recommendation (which is better I think) is use the same logic from the above but when user was redirected to m.yourweb.com/ load css file for mobile version web instead of normal web. loading css through JS

If you think this is complicated, you might be interested in having a look at CSS3 media queries. This basically changes CSS layout depending on current users' screen. resolution Media queries tutorial

Upvotes: 0

btevfik
btevfik

Reputation: 3431

index.html or default.html is the convention. so why not direct to

m.websitename.com/index.html

and configure the subdomain so that m.websitename.com is actually pointing to websitename.com/m folder. so that folder can have its own index file.

Upvotes: 1

Related Questions