Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 9 of 9
  1. #1
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    Why is it that when you type in some webpages into your URL address bar, you don't need the .htm/.html? Is there some kind of coding that is in the header to make this happen?

    For instance, if you type in nfl.com/news, it will pull up the http://www.nfl.com/news page.

    If I attempt this on a client's website, the page cannot be found...

    Any suggestions?

  2.  

  3. #2
    Senior Member solidgold's Avatar
    Join Date
    Jun 2006
    Posts
    766
    Member #
    13373
    those links are a new directory, i reckon that if you enter www.nfl.com/news/index.html it would come up with the same page are you would using the directory address

  4. #3
    Senior Member Karloff's Avatar
    Join Date
    Oct 2005
    Posts
    744
    Member #
    11702
    I believe, and don't quote me here, that if you use ruby it will automatically get rid of the file type at the end but also you can use mod-rewrite to do this.

    like i said don't quote me on this, a mod would probably answer this in greater detail (shadowfiend and wired and keen ruby railers)

    you could also achive this by putting the each individual file into a seperate file and calling it index.php (or whatever) and you will get that file coming up...... i think

  5. #4
    Senior Member
    Join Date
    Aug 2003
    Posts
    194
    Member #
    2782
    My client seems to like the fact that you can type in company.com/category and it will show the sub-directory's index page. From a designing standpoint, this only seems necessary if a site has a lot of pages and needs to be categorized into sub-directories. It seems kind of redundant to me to create a small site and put each individual navigation page into its own subdirectory just so someone can type in the URL address bar company.com/category.

    Do you agree? Or do you see advantages in this sort of structure for a small site?

  6. #5
    Senior Member Eddy Bones's Avatar
    Join Date
    Jan 2004
    Location
    Washington, USA
    Posts
    1,054
    Member #
    4651
    It has to do with the way the server is configured. If you leave out the page that you want, it will go through a list of defaults, and it will pull up the first one that it finds in that directory. If it doesn't find one of those defaults, you'll get a 404 error.

    On MS servers, the default that it looks for is (who would have guessed this one...) default.* where the extension is variable.

    On Apache the default is index.html or index.html.var I believe.

    [edit] The only advantage to having directories is that the page can be left out of the URL. If it's a small site it would be over the top, IMO. But sometimes we just like going over the top anyway...

  7. #6
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Yes, there are several tools that make it so that you can refer to regular .html pages through other names. Rails exclusively uses non-extension URIs that are pointed at certain parts of the application (through `routes', as they are called in Rails). Extensions on a Rails app don't translate into different files but rather in a call to the same place with a different `format' parameter, so that appropriate action can be taken to render the data differently.

    J2EE by default will let you access jsp pages directly, but servlets are mapped through an application.xml file from arbitrary URIs, so again you often find yourself without an extension on these. ASP.NET probably follows a similar approach.

    Regular sites that run PHP or somesuch find themselves with little direct access to such configuration, so instead you configure Apache itself using [minicode]mod_rewrite[/minicode], which basically lets you rewrite arbitrary URIs into URIs that your application will understand. For example, say you have a `news.php' file but you want to access it as [minicode]/news[/minicode]; then you will use mod_rewrite to rewrite the /news reference into [minicode]/news.php[/minicode], which is the place where your actual file sits. The user then can type in /news and the appropriate action will be taken.

    There's a lot of information on mod_rewrite out there, and it largely depends on at least basic understanding on regular expressions, but it's an extremely powerful tool that lets you do some pretty neat things with your URIs.

  8. #7
    Senior Member Eddy Bones's Avatar
    Join Date
    Jan 2004
    Location
    Washington, USA
    Posts
    1,054
    Member #
    4651
    Mod_rewrite huh...

    I guess I have something new to tinker with now. I never knew about that.

  9. #8
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    ASP.NET definitely lets you access some scripts directly; think of all those URLs you see with .aspx in the extension.

    There are three solutions to this "problem":
    • Put each page in a directory. It helps with organization as well. Even a tiny site benefits.
    • Use some Apache mod_rewrite magic to hide the extension, even though the files are still physically there and still directly accessible. This is what WDF v5 uses for some links.
    • Ditch the filesystem layout entirely and write an application with a single entry point and an event dispatcher that decides on its own, without help from the web server, what resource the user actually requested. This is how WDF v6 works.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  10. #9
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Quote Originally Posted by filburt1
    • Ditch the filesystem layout entirely and write an application with a single entry point and an event dispatcher that decides on its own, without help from the web server, what resource the user actually requested. This is how WDF v6 works.
    This is, as a side note, also how the Rails system works.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:49 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com