Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other /whatever/ instead of /whatever.php ? Re: /whatever/ instead of /whatever.php ?

#80127
TheDoc
Member

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:

Code:
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:

https://css-tricks.com/downloads/index.php
or
https://css-tricks.com/downloads/

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