blosxom :: the zen of blogging


  • home/about
  • features
  • colophon
  • news
  • mailing list

  • documentation for users

  • overview
  • install
  • configure
  • blog
  • view
  • flavour
  • syndicate
  • plugins
  • plugin registry
  • static
  • faq
  • use cases*
  • documentation for developers

  • overview
  • plugins
  • downloads

  • mac
  • windows*
  • everyone

  • license
  • contributed*
  • powered by

    How do I hide the /cgi-bin/blosxom.cgi bit of my URL?

    If you don't want to see the /cgi-bin/blosxom.cgi part of your URL, there are a couple-three methods available to you...

    • If you are able to run CGI scripts in directories other than cgi-bin, place blosxom.cgi into a subdirectory called weblog or blog or whatever you please. Now you can access your blog at /weblog/blosxom.cgi or the like, depending on what subdirectory you used.

      You may also be able to hide CGIs by renaming them to index.cgi, so that you can address your weblog simply by the subdirectory in which it lives, /weblog or the like. This works when the Web server has been configured to consider index.cgi a DirectoryIndex just like index.html. If this does work for you, be sure also to change $url in your newly renamed index.cgi (what used to be blosxom.cgi, setting it to the URL of your subdirectory. E.g.:

      # What's my preferred base URL for this blog (leave blank for automatic)?
      my $url = "http://www.example/weblog";
    • If you have access to your web server's configuration file (for Apache, that's httpd.conf) or your local sysadmin or service provider is willing to make changes for you, aliasing a particular URL to your script is probably the easiest way to go. For example, under Mac OS X, just add to /etc/httpd/httpd.conf:

      ScriptAlias / /Library/WebServer/CGI-Executables/blosxom.cgi
    • If you don't have access to your web server's configuration file or your sysadmin/provider can't/won't make changes for you, you just might have mod_rewrite, a very powerful Apache web server module for altering URLs and much more, available to you.

      1. Put the blosxom.cgi script in your cgi-bin directory -- the directory where you're allowed to keep scripts and have them run.

      2. Create a regular text file called .htaccess in your document directory -- where all of your Web-accessible HTML files are kept. The .htaccess file should look something like:

        RewriteEngine on
        RewriteRule ^weblog/?(.*)$ /cgi-bin/blosxom.cgi/$1

        Where weblog is wherever you'd like your weblog to live (in this case /weblog) and cgi-bin is where you're supposed to call scripts from your Web browser to have them run.

      3. All of your entries, flavour files, stylesheets, and so forth should live, as they always have, in your Blosxom $datadir.

      4. Another version of this allows you to serve up your weblog at /, rather than requiring a "subdirectory" like /weblog. It's rather clever, really, farming out to Blosxom any request for a file or directory that doesn't exist. Blosxom as 404 ;-) Simply Blosxom into your document directory along with a .htaccess reading:

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ blosxom.cgi/$1 [L,QSA]

        Point your browser at /something and, if there exists no /something directory, Blosxom should kick right in.

      Now, any URL starting with /weblog is intercepted by the rewrite engine and passed to the blosxom.cgi script, along with anything after /weblog (and an optional /) is passed to my CGI script as path_info, as it should be.

      Any URL not starting with /weblog is served up just like it should be, so stylesheets, other arbitrary HTML files, graphics, and so forth are reachable at /whatever/their/url.

      Author: Rael Dornfest
      Category: /faq/cgi
      Date: 2003-08-20 Logo