NanoG6
NanoG6

Reputation: 56

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!

Upvotes: 1

Views: 1209

Answers (2)

NanoG6
NanoG6

Reputation: 56

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!

Upvotes: 1

unNamed
unNamed

Reputation: 1019

Try to use http://redmine.lighttpd.net/wiki/1/Docs:ModRewrite
url.rewrite-once = ( "^/(.+)$" => "/index.php/$1" )
No idea if you need a special structure there or if wordpress is able to figure out which content to view with that.
About your error handler: It will not trigger until the CGI application returns a 404. And from what you described wordpress prefers a redirect before sending you a 404 error. That's why it's not working :P

Upvotes: 2

Related Questions