Search

Friends

Atomspheric CO2 (PPM)

Archives

Blather

Uptime verified by Wormly.com

8 September 2006

Lighttpd, WordPress and Pretty URLs

I've found an easier way to rewrite WordPress URLs than attempt to recreate all of the crazy combinations.

url.rewrite-once = ( "^([^.]+)$" => "index.php$1" )

It basically rewrites anything that doesn't have a full-stop in it. So if you use it, make sure all your images and stylesheets have file extensions.

Comments

  1. Good, but if you are using virtual hosts for some reason the pretty urls work fine for normal webpages, but when you try to get the default page by just typing in the URL it doesn’t work.

    Works

    http://www.blah.com/about – this will map to http://www.blah.com/about.php

    Doesn’t Work

    http://www.blah.com – doesn’t find the default index.html page anymore

    This is using evhost in lighttpd.

    Enzo / 2:06pm / 10 January 2008

  2. Yeah. It won’t work for Lighttpd-handled URLs that don’t have a full-stop in them. This was just a hack to solve my problem without writing all the different options.

    You could try this though.

    url.rewrite-once = ( "/" => "/index.html", "^([^.]+)$" => "index.php$1" )
    

    Ryan / 2:32pm / 10 January 2008

  3. just for the records, dont do
    "/" => "/index.html"
    correctly it looks like
    "^/$" => "/index.html"

    ttl / 12:20am / 2 January 2011

  4. Ah yes. Thanks.

    Ryan / 3:30pm / 2 January 2011

Leave a comment

Markdown

0.104 seconds