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

PHP Enhancing a Simple PHP Application Adding Search: Controller & View Creating the Search Page

Clay Kinder
Clay Kinder
14,519 Points

Internal Server Error after downloading this video's project files

There were some other threads about this, but they didn't help me so I figured I'd bring this issue to someone's attention again.

I downloaded the project files and moved them into my htdocs after unpacking them. My htdocs looks like this:


contact (folder)
css (folder)
favicon.ico
img (folder)
inc (folder)
index.php
receipt (folder)
shirts (folder)
.htaccess


The other threads seemed to indicate that this was an issue with the .htaccess file so here is what mine contains:


RewriteEngine On RewriteRule ^shirts/$ /shirts/shirts.php RewriteRule ^shirts/([0-9]+)/$ /shirts/shirt.php?id=$1 RewriteRule ^receipt.php$ /receipt/ [R=301] RewriteRule ^contact.php$ /contact/ [R=301] RewriteRule ^shirts.php$ /shirts/ [R=301] RewriteRule ^(shirts/[0-9]+)$ /$1/ [R=301]

RewriteCond %{QUERY_STRING} ^id=([0-9]+)$ RewriteRule ^shirt.php$ /shirts/%1/? [R=301]


Any and all help would be greatly appreciated.

Some simple steps to verify where things are going wrong: (check if your website works after each suggestion)

  1. remove (or at least move it out of htdocs) and see if the problem is indeed with hatches
  2. make sure error reporting & display errors are both ON so you get any errors displayed
  3. check if any of the files don't have a php error..

if the error is on .htaccess file, I would recommend copying all of the htaccess file content into a blank document and then putting it back line by line to see which line has the error..

2 Answers

Clay Kinder
Clay Kinder
14,519 Points

I followed your advice and cut all of it, replacing it line by line. I didn't change anything, but by the time I pasted all of it in, it was all working. Hooray for strange solutions!

Thank you!

Dermot Condron
Dermot Condron
4,010 Points

I had the same problem on my localhost using wamp server. The problem for me was related to the rewrite rules in the .htaccess file. By default the apache software is not set to use rewrite rules so if you enable this module in apache it can read the htaccess file. In wamp go to the server icon at the bottom right menu on your screen where date,time etc is displayed. Select Apache> Apache Modules and scroll down until you see rewrite_module and enable it. This should eliminate the internal server error.