Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

dariuszgrzywacz
10,770 Points.php extension - making a website
i want to make a website that consits of parts that repeat themselves on many sites (say footer and nav)
copy&pasting them into a single website is extremly time consuming and you can easily forget about a page, so i am more into including them using PHP from external file
but then my webpage gets .php extension and i almost never see this when browsing internet. Do people somehow hide it, or they dont use PHP?
3 Answers

Riku S.
11,322 PointsMost websites use something like Apache mod_rewrite module, which rewrites URI:s. Lets say www.example.com/products/blue-magic-hat/ can be rewritten to www.example.com/index.php?category=products&product=blue-magic-hat. So very often you can't tell if page uses php or some other languages.

dariuszgrzywacz
10,770 Pointsalright then! do you recon if there is anything on TreeHouse regarding apache rewrite module?:)

Kevin Korte
28,149 PointsAnother option, if your site is very small, is to take advantage of the index.php option. Meaning, if you had and /about folder, and then an index.php file in that, the url would only be mydomain.com/about and if you also had a /contact folder with an index.php file the url would be mydomain.com/contact, and each url would use it's respective index.php file.
Another very popular option today are mvc framworks, like laravel or slim, which provide routing options that allow you to write whatever route you want, and call a certain view, or set of views to use at that route.
Check this course for rewrite rules: https://teamtreehouse.com/library/enhancing-a-simple-php-application