URL Rewriting - eksopl/fuuka GitHub Wiki

Remove cgi-board.pl from URLs

Introduction

LOCATION_HTTP in board-config.pl changes how fuuka outputs URLs. It defaults to $ENV{SCRIPT_NAME}, which is the full path to the cgi-board.pl. You can make URLs better by adjusting this constant and applying some mod_rewrite rules.

Howto

  • Edit LOCATION_HTTP. Change it to the desired root of your archive, but don't include a trailing slash. For example, if you want to have URLs like http://archive.example.com/a/, use an empty string (''). If you want to have URLs like http://example.com/archive/a/, use '/archive'
  • Add the following rule to your .htaccess. Adjust accordingly, RewriteBase needs to be set to the same thing as LOCATION_HTTP (but with a trailing slash).
DirectoryIndex cgi-board.pl index.html index.php
RewriteEngine On
RewriteBase /archive/
RewriteRule ^(a|jp|m|tg)(/|$)(.*)? cgi-board.pl/$1/$3 [NC,L]

You can omit it altogether if you're running the archive on the root dir:

DirectoryIndex cgi-board.pl index.html index.php
RewriteEngine On
RewriteRule ^(a|jp|m|tg)(/|$)(.*)? cgi-board.pl/$1/$3 [NC,L]

For lighttpd, the syntax is as follow: url.rewrite-once = ( "^/(a|jp|m|tg)(/?)(.*)?" => "/cgi-board.pl/$1$2$3" )

All that is shown here is how to hide cgi-board.pl from your URLs. Further URL prettifying should be possible with more intricate rewrite rules.