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 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