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 trialMark Hardy
Courses Plus Student 3,502 PointsProject Files not working for me
I ran through the first PHP project in the track and wanted to see how the whole project looks at the end of this course. Oddly enough, I copy the project into MAMP's htdocs (I moved shirts.php into the home directory per others' reports) and when I click on a shirt either on the home or in the catalog, I get a 404 error:
"Not Found
The requested URL /shirts/101/ was not found on this server."
It's strange because this works fine on the version I made with the Building a Simple PHP Application course. Is this a problem with the project files for the second PHP course?
3 Answers
thomascawthorn
22,986 Pointshave you changed the location where MAMP is pointing?
Mamp -> Preferences -> Apache
Then select the appropriate document root from the file tree. This is quite nice because you won't have to clog up a single htdocs folder. The document root you're after is wherever the home page 'index.php' file is sitting.
thomascawthorn
22,986 PointsIn the root of your project where your index.php file is sitting (aka the home page), is there a file named '.htaccess' at the same level?
Ge W
4,992 PointsThe .htaccess file does not work in my current version of MAMP, despite the effort to turn override on in Apache configuration file. I then have to modified the urls to make it work without .htaccess overwrite rules. The urls in the project files linking to shirts.php (and shirt.php) also contain minor mistakes. And this can be rectified by adding directory name shirts/ before each of the corresponding shirt(s) urls.
Mark Hardy
Courses Plus Student 3,502 PointsMark Hardy
Courses Plus Student 3,502 PointsI have this set up correctly. index.php is in htdocs without any other index files.
Mac HD -> Applications -> MAMP -> htdocs
Are you not able to replicate the same issue I'm experiencing?
Everything else works fine except the shirts detail page.
Konrad Pilch
2,435 PointsKonrad Pilch
2,435 PointsI got the same problem.
thomascawthorn
22,986 Pointsthomascawthorn
22,986 PointsIf you have your .htaccess file, can you post it?
Use the 'Markdown Cheatsheet' to see how to format it.
Konrad Pilch
2,435 PointsKonrad Pilch
2,435 Points.htaccess file ? What is this? what do you mean?