Search code examples
wordpresslighttpdpermalinksphp

Permalinks with Lighttpd and PHP-FPM


I'm using Lighttpd on my server installation, and permalinks went fine with PHP FastCGI. But recently I change FastCGI with PHP-FPM and my custom permalinks no longer working.

Everytime I click a post / page, wordpress just brings me to the home / frontpage. My custom permalinks is like this /%postname%-%post_id%.html But if I use custom permalinks like /index.php/%postname%/ or /index.php/archives/%post_id% (include the index.php) it works! But that is not what I want..

I tried using server.error-handler-404 = "/index.php" on lighttpd.conf but still no luck.

Any help would be greatly appreciated. Thanks!


Solution

  • yes you're right, i have to use mod rewrite. my rewrite rules are like this:

    $HTTP["host"] =~ "(^|\.)domain\.com$" {
       url.rewrite-once = (
          # Exclude additional specific directories from rewrites
          "^/(files)/?(.*)" => "$0",
          "^/(mysql)/?(.*)" => "$0",
    
          "^/(wp-.+).*/?" => "$0",
          "^/(favicon.ico)" => "$0",
          "^/(sitemap.xml)" => "$0",
          "^/(xmlrpc.php)" => "$0",
          "^/keyword/([A-Za-z_0-9-])/?$" => "index.php?keyword=$1",
          "^/(.+)/?$" => "index.php/$1"
       )  
    }
    

    and now it works perfectly. Thanks!