Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My original goal was to rewrite requests to to node really is a physical directory containing index.cgi, located directly under the document root. That bit is fairly straightforward:

AddHandler cgi-script .cgi
Options         +FollowSymLinks +ExecCGI
RewriteEngine   On
RewriteBase     /node
RewriteCond %{REQUEST_FILENAME} !index.cgi
RewriteRule ^(.*)$ /node/index.cgi?$1 [L,QSA] the .htaccess file under /real/path/to/web/stuff/node.

Note that this means requests of the form supply an empty query string to index.cgi, which is what I want.

So now the tricky part: I want requests to to redirect to — which, as above, redirects to index.cgi with an empty QS. The trouble is, if I don't have any rules in my root dir, a request for does indeed seem to go to — but I find that the query string given to index.cgi is the full physical path corresponding to the request (/real/path/to/web/stuff/node)!

I've tried a rule in my root level .htaccess like:

RewriteCond %{REQUEST_URI} =/node
RewriteRule ^(.*)$ /node/ [L] # (also tried [L,R=302])

But that has no effect.

I realise that Apache does some trailing-slash appending under the hood, but I can't use DirectorySlash Off... and I wouldn't want to if I could, since I have a Drupal installation residing in the root (there are a bunch if similar rewriting rules in there, but I don't think they're interfering).

So is it possible to either create a rule for the root directory .htaccess that works, or a modify the /node/.htaccess to make it not matter? Even physically moving things around is not beyond reason.

This is on a host running Apache 1.3.41 on FreeBSD 7.3. I don't have the ability to change anything about the server config itself, only my .htaccess files (which means I can't even turn on rewrite logging!).

share|improve this question

The Apache 1.3 documentation has an entry referring to the "trailing slash problem", maybe it may help you for that scenario.

Regarding your rules with the node IDs, the RewriteBase maybe your problem since "the local directory prefix is stripped .. and your rewriting rules act only on the remainder" as documented in the RewriteBase docs.

share|improve this answer
Removing the RewriteBase didn't have any effect. I still get the full local path as the URL. – detly Jan 25 '11 at 12:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.