SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    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/4...in-wamp-server and http://www.sitepoint.com/forums/show...p-local-server. Did not work. Suggestions welcome.

    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

    Code:
    # 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>

  2. #2
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,266
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    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.)

    Code:
    # 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>
    "First make it work. Then make it better."

  3. #3
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,266
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    Seems like your local server is missing mod_expires and mod_headers. They're not loaded by default.
    "First make it work. Then make it better."

  4. #4
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jeff Mott View Post
    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?

  5. #5
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jeff Mott View Post
    Seems like your local server is missing mod_expires and mod_headers. They're not loaded by default.
    Walla! That did it. Awesome thank you


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •