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.

PHP Building Websites with PHP Slim Basics & Twig Templates Including & Running Slim

500 Internal server error

The following error is now displayed in browser after renaming to .htaccess

Internal Server Error

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

Please contact the server administrator at admin@example.com to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

4 Answers

Erik McClintock
Erik McClintock
45,783 Points

Kudakwashe,

This server error is likely due to you having a syntax or spelling error somewhere in your .htaccess file. Really comb through it to make absolutely certain that nothing is out of place, then try uploading it again and see if your server error is fixed.

Erik

Hi Erik, thanks. I checked my .htaccess file everything seems to be fine. Here is the code;

RewriteEngine On

Some hosts may require you to use the RewriteBase directive.

If you need to use the RewriteBase directive, it should be the

absolute physical path to the directory that contains this htaccess file.

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [QSA,L]

clear everything in your .htaccess file and replace it with this

<IfModule mod_rewrite.c> Options +FollowSymlinks Options +Indexes RewriteEngine on

# if your app is in a subfolder #RewriteBase /my_app/

# test string is a valid files RewriteCond %{SCRIPT_FILENAME} !-f # test string is a valid directory RewriteCond %{SCRIPT_FILENAME} !-d

RewriteRule ^(.*)$ index.php?uri=/$1 [NC,L,QSA] # with QSA flag (query string append), # forces the rewrite engine to append a query string part of the # substitution string to the existing string, instead of replacing it. </IfModule>

AddType text/css .less AddType image/svg+xml svg svgz AddEncoding gzip svgz

cynnimon
cynnimon
4,001 Points

Hi, if you're using WAMP server and not workspaces try giving Carlos Zavala's answer in this thread a look:

https://teamtreehouse.com/community/500-internal-server-error-5