Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools Using PHP with MySQL Connecting PHP to MySQL Creating the Products Table

Christian Simon
PLUS
Christian Simon
Courses Plus Student 30 Points

The .htaccess is not working on my WAMP Local Server, I keep receiving Internal Error Messages

I keep receiving this: Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, admin@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log. Please how do I fix it, Thanks

Are you certain that it's related to .htaccess? Does the error go away when you remove rules from your .htaccess file? Can you post what you have in your .htaccess file if that is the case so we can review it?

4 Answers

Have you ensured that mod_rewrite is enabled? For WAMP, click the WAMP icon in your tool bar and go to Apache > Apache Modules > rewrite_module and ensure that it has a checkmark next to it.

Christian Simon
Christian Simon
Courses Plus Student 30 Points

Thanks, the Issue was from the Mod_Rewrite Extension.....

Sean T. Unwin
Sean T. Unwin
28,656 Points

It's likely a syntax error in the .htaccess.

To test, remove or rename the file temporarily and check if the server still gives an error.

You could also look at the server error log. You'd likely only have to read the last few entries - check for date/time.

Christian Simon
PLUS
Christian Simon
Courses Plus Student 30 Points

Yes when I completely removes the .HTACCESS rules, the side loads just fine but any Link you clicks after then gives an error not found and when I checked, I realized the it is the .HTACCESS that controls the URL Structuring or Symlink or whatever it's being called.

Here is the .HTACCESS file: 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]

After removing this .HTACCESS and trying to load a page like the shirts page which is suppose to be Product/shirts/shirts.php, it will be this instead shirts/shirts.php which happens to be missing the base URL of the file which happens to be Product. You help will really be Appreciated.