Treehouse: Grow your CSS skills. Land your dream job.

/whatever/ instead of /whatever.php ?

  • # July 21, 2010 at 2:57 am

    I’m just getting back into web design after a few years and i noticed that page extensions are non existent now.

    For example: instead of something like

    I’m not sure how this works, what is going on here? is there some vids or articles I can check out?

    # July 21, 2010 at 3:10 am

    Since a lot of sites are generated dynamically now, it’s a lot easier to have the system set up folders automatically and place an index.php or index.html inside that folder.

    You can also remove extensions via .htaccess:

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.html -f
    RewriteRule ^(.*)$ $1.html
    # Replace html with your file extension, eg: php, htm, asp

    Why do people do it? It looks a hell of a lot cleaner to me. Which would you rather see in the url:

    It looks a lot cleaner without the index.php beside it, and it means it’s one less thing for users to remember.

    # July 21, 2010 at 10:02 pm

    Thank you I will look into it!

    Very helpful

    # July 25, 2010 at 7:05 pm

    One thing to note is that I’ve found certain hosting providers give certain limits to what you can do with htaccess. On my godaddy hosted site, nothing I did to the htaccess stuck, but on my MT hosted account it works just fine.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.