Can't get my .htaccess to work with Wamp?

Hello. I’m getting a Internal Server Error. If I change my htaccess to htaccess.txt it all works fine. If I change it to .htaccess it throws that error. Could it be the contents of my htaccess? I assumed though that if it works fine in my server it would work in Wamp. ??? I’ve tried all the suggestions in both of these threads. http://stackoverflow.com/questions/4391530/how-to-use-htaccess-in-wamp-server and http://www.sitepoint.com/forums/showthread.php?997115-does-htaccess-works-in-wamp-local-server. Did not work. Suggestions welcome. :slight_smile:

Also while I’m at it… A few months a go my wamp icon wont change to green. It just starts red then changes to orange. It still works. Any tricks for that?

Here are the contents of my htaccess

# UTF-8 encoding and English language all file extensions
AddDefaultCharset utf-8
AddCharset utf-8 .php .html .css .js .xml
DefaultLanguage en-US

# mod_rewrite On only needed once
RewriteEngine On

# 301 permanent redirect index.php to folder
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\\ /([^/]+/)*index\\.php\\ HTTP/
RewriteRule ^(([^/]+/)*)index\\.php$ http://www.websitecodetutorials.com/$1 [R=301,L]

# 301 permanent redirect non-www (non-canonical) to www
RewriteCond %{HTTP_HOST} !^(www\\.websitecodetutorials\\.com)?$
RewriteRule (.*) http://www.websitecodetutorials.com/$1 [R=301,L] 

# Compress Files 
<FilesMatch "\\.(js|css|html|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>

# Turn off ETags
Header unset ETag
FileETag None

# Cache Files 90 Days
<filesMatch "\\.(php|html|css|js|swf|pdf|xml|mp3|gif|jpg|png)$">
ExpiresActive On
ExpiresDefault "access plus 90 days"
Header append Cache-Control "public"
</filesMatch>

My approach to this kind of troubleshooting is to comment out all the lines, confirm it works, then start uncommenting one by one until I find the line that causes the issue. In your case, the lines in red seemed to cause the issue. (I tested on Apache 2.4.3 with default config except that mod_rewrite was loaded.)

# UTF-8 encoding and English language all file extensions
AddDefaultCharset utf-8
AddCharset utf-8 .php .html .css .js .xml
DefaultLanguage en-US

# mod_rewrite On only needed once
RewriteEngine On

# 301 permanent redirect index.php to folder
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\\ /([^/]+/)*index\\.php\\ HTTP/
RewriteRule ^(([^/]+/)*)index\\.php$ http://www.websitecodetutorials.com/$1 [R=301,L]

# 301 permanent redirect non-www (non-canonical) to www
# RewriteCond %{HTTP_HOST} !^(www\\.websitecodetutorials\\.com)?$
# RewriteRule (.*) http://www.websitecodetutorials.com/$1 [R=301,L]

# Compress Files
<FilesMatch "\\.(js|css|html|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>

# Turn off ETags
[COLOR="#FF0000"]Header unset ETag[/COLOR]
FileETag None

# Cache Files 90 Days
<filesMatch "\\.(php|html|css|js|swf|pdf|xml|mp3|gif|jpg|png)$">
[COLOR="#FF0000"]ExpiresActive On
ExpiresDefault "access plus 90 days"
Header append Cache-Control "public"[/COLOR]
</filesMatch>

Seems like your local server is missing mod_expires and mod_headers. They’re not loaded by default.

Hey thanks! Are those in wamp already I just need to activate them?

Walla! That did it. Awesome thank you