Question about browser detection...

3 replies
I'm building a mobile html site for a client who has a php site. I have a php mobile redirect script I could insert into the client's index.php file, however he wants a landing page which allows the mobile user to choose between the mobile site and the regular site. If I have the redirect script point to the mobile landing page, when the mobile user clicks on the option for the regular site, it will keep bringing them back to the landing page. So I was thinking of naming the landing page as index.html (with the redirect script on it) to differentiate between that and the regular site's index.php. I am just wondering if this is possible, and if so, will the browser access the index.html extension by default over the php when the root domain is entered in the address bar? I hope my question is not too confusing.
#browser #detection #question
  • Profile picture of the author wasabi20
    Hi there,

    You can do this by adding in your .htaccess

    DirectoryIndex index.php
    So by default, the main page will be index.php

    I hope this help
    {{ DiscussionBoard.errors[5029750].message }}
  • Profile picture of the author PrivateCitizen
    Thanks wasabi20,

    Actually I want to make sure that the index.html appears first, so I assume I would just change the last part of that code to html?
    {{ DiscussionBoard.errors[5030654].message }}
  • Profile picture of the author wasabi20
    Hi there,

    Yes you have simply to put in .htaccess in the root directory (so the main folder ex: public_html or www)

    DirectoryIndex index.html
    {{ DiscussionBoard.errors[5032414].message }}

Trending Topics