How do I make mod rewrite work with lighthttpd?

Discussion in 'Site & Server Administration' started by WoW Blood, May 18, 2009.

  1. #1
    Okay I have 2 wordpress blogs and I am using lighthttpd and I used to use Apache and the mod rewrite worked fine but I can't use that now so how do I make mod rewrite work with lighthttpd?
     
    WoW Blood, May 18, 2009 IP
  2. relixx

    relixx Active Member

    Messages:
    946
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    70
    #2
    relixx, May 18, 2009 IP
  3. WoW Blood

    WoW Blood Well-Known Member

    Messages:
    164
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    135
    #3
    I paste the
       1.
          $HTTP["host"] =~ "gagrigs\.com" { 
       2.
          url.rewrite-final = ( 
       3.
          # Exclude some directories from rewriting 
       4.
          "^/site/(wp-admin|wp-includes|wp-content|gallery2)/?(.*)" => "$0", 
       5.
           
       6.
          # Exclude .php files at root from rewriting 
       7.
          "^/site/(.*\.php)" => "$0", 
       8.
          # Handle permalinks and feeds 
       9.
          "^/site/(.*)$" => "/site/index.php/$1" 
      10.
          ) 
      11.
          }  
    Code (markup):
    into my lighttpd.conf file but when I restart lighthttpd it doesn't start back up.
     
    WoW Blood, May 18, 2009 IP
  4. relixx

    relixx Active Member

    Messages:
    946
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    70
    #4
    did you modify the $HTTP["host"] line to reflect your domain?
     
    relixx, May 18, 2009 IP
  5. WoW Blood

    WoW Blood Well-Known Member

    Messages:
    164
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    135
    #5
    yea it looked like
    
    $HTTP["host"] =~ "narutoforfree\.com" {
    url.rewrite-final = (
    # Exclude some directories from rewriting
    "^/site/(wp-admin|wp-includes|wp-content|gallery2)/?(.*)" => "$0",
    
    # Exclude .php files at root from rewriting
    "^/site/(.*\.php)" => "$0",
    # Handle permalinks and feeds
    "^/site/(.*)$" => "/site/index.php/$1"
    )
    }
    
    Code (markup):
    also i just put the code at the bottom of my .conf file...do i need to put it in a certain place?
     
    WoW Blood, May 19, 2009 IP
  6. relixx

    relixx Active Member

    Messages:
    946
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    70
    #6
    OK, just to check - did you enable mod_rewrite for lighttpd?

    Also, try removing "site/" from the lines above - thus the config for your site should be:
    
    #I added in the (www.)? bit below just in case you ever decided to have the www version also point to the domain, so that the regex will check for it
    $HTTP["host"] =~ "(www.)?narutoforfree\.com" {
      url.rewrite-final = (
     
        # Exclude some directories from rewriting
        "^/(wp-admin|wp-includes|wp-content|)/(.*)" => "$0",
     
        # Exclude .php files at root from rewriting
        "^/(.*.php)" => "$0",
     
        # Handle permalinks and feeds
        "^/(.*)$" => "/index.php/$1"
      )
    }
    
    Code (markup):
    This is assuming that wordpress is installed at the top of the site (ie, not in a subdir). If the software that streams the videos is in a subdir, then add that subdir to the exclusion line.
     
    relixx, May 19, 2009 IP
  7. WoW Blood

    WoW Blood Well-Known Member

    Messages:
    164
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    135
    #7
    Okay thanks for the help relixx I got it too work:)
     
    WoW Blood, May 25, 2009 IP
  8. relixx

    relixx Active Member

    Messages:
    946
    Likes Received:
    54
    Best Answers:
    0
    Trophy Points:
    70
    #8
    Cool, good to hear :)
     
    relixx, May 27, 2009 IP