Is this easy to do. I've noticed some servers do this, and I was wondering if this is a setting or the type of server the site is hosted on.

Thanks!

    Uhhh, I don't think so. I mean, my main page is index.php. When you nav to http://www.yoursite.com you see http://www.yoursite.com in the address bar, not the index.php.

    What I was asking was, regardless of what the full URL is, how can I make it only show the directory name without the file names?

    Example:
    If I click a link which takes me to http://www.yoursite.com/filename.php how can I make it not show the filename.php portion?

    Thanks.

      Why would you want to do this? It would mean people couldnt bookmark or link to specific pages.

      This would be more awquard than its worth.

        My original question wasn't if this was a good idea, but rather I've noticed some servers do this, and I was wondering if this is a setting or the type of server the site is hosted on?

        Do you know?

          You can use frames on the index page.

            Without using frames or mod_rewrite, the only alternative I can think of would be links such as www.yoursite.com/?page1 so that in your index.php you'd do:

            $page = (!empty($_SERVER['QUERY_STRING']) $_SERVER['QUERY_STRING'] : '');
            $valid = array('page1', 'page2', 'page3', 'page4');
            
            if($page == '') {
                // index here
            } elseif(in_array($page, $valid)) {
                include $page . '.php';
            }

              Another method (with no dynamism) would be to name every page "index.html" and have each in its own directory 🙂

              But seriously, unless we are talking about frames, then sites that do this are doing some method of mapping URLs to resources that is a bit more sophisticated than a plain a 1-1 URL/filepath. What should be remembered at all times in this context is that a URL and a file path are not the same thing, and that it's the server's job to match resources to URLs. Having "http://www.example.com/foo/bar.php" map directly to "/var/www/htdocs/foo/bar.php" is only the very simplest mechanism.

                Write a Reply...