It’s really simple to get great permalinks with WordPress and lighttpd.
The default permalink format leaves you with URLs like http://myblog.com/?p=3. This isn’t great for SEO (showing up as high as possible in Google’s search rankings).
Instead, you want your URL to contain something about the content of your post. We’ll use the title.
Google also favors information closer to the domain name, so http://myblog.com/how-to-eat-figs is better than http://myblog.com/2008/03/18/how-to-eat-figs.
In WordPress, go to Options -> Permalinks and select “Custom.” Enter this.
/%postname%.html
In your /etc/lighttpd/lighttpd.conf, here’s the section for your blog host. The url.rewrite and server.error-handler-404 sections are the important ones.
$HTTP["host"] =~ "myblog\.com$" {
$HTTP["host"] !~ "^www\.myblog\.com$" {
url.redirect = ("^/(.*)$" => "http://www.myblog.com/$1")
}
url.rewrite = ("\.html$" => "/index.php")
server.document-root = "/web/myblog/public_html/"
server.error-handler-404 = "/index.php?error=404"
}
This way, your permalinks end in “.html” so they’re right off your domain and they look like static content. Then your lighttpd.conf takes anything ending in “.html” and routes it to WordPress.
And now this blog is rolling…
Hi,
I have 2 blog running in one domain.
1) www. domain. net/blog/
2) subdomain.domain.net
before this, Im using Apache
this are the mod rewrite for 1st blog in apache:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
and this are the mod rewrite for the 2nd blog:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
after I change my shared hosting to VPS, I only can use lighthttpd. So I
google about this and find this code:
url.rewrite-once = (
“^/(wp-. ).*/?” => “$0?,
“^/(sitemap.xml)” => “$0?,
“^/(xmlrpc.php)” => “$0?,
“^/keyword/([A-Za-z_0-9-] )/?$” => “/index.php?keyword=$1?,
“^/.*?(?.*)?$” => “/index.php$1?
)
the code works great for the 2nd blog, but not for my 1st blog. I can
access www. domain. net but if I click hyperlink to www. domain. net/blog I
will get 404 error.
Please help me, If you find the solution please email to skycrewz [at] gmail.com
thank you
You probably need to add /blog/ to everything on the rewrite section. Also, do you have different $HTTP[‘host’] directives set up for each blog?