First this is wrong:

Options -Indexes +FollowSymLinks

You should never mix + and - in the Options.

Second if you read mod_rewrite docs you will see that QSA flag appends something, which is why you have double "test" as rewrite result.


On Jun 5, 2012 4:29 AM, "Jimmy Thrasibule" <> wrote:

I'm trying to pass everything that is not a file to `index.php` as a
request parameter without using a `.htaccess` file.

A request to must be rewritten to

I'm using Debian Squeeze (6.0) and Apache 2.2.16. Here is my
configuration file:

<VirtualHost *:80>
 DocumentRoot /var/www/example

 ErrorLog /var/log/apache2/error/example.log
 CustomLog /var/log/apache2/access/example.log combined

 <IfModule mod_rewrite.c>
   RewriteEngine On

   RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
   RewriteRule ^/(.*)$1 [L,R=301]

 <Directory "/var/www/test">
   AllowOverride None
   Options -Indexes +FollowSymLinks
   DirectoryIndex index.php

   <IfModule mod_rewrite.c>
     RewriteEngine On
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
     RewriteCond %{REQUEST_URI} !=/favicon.ico
     RewriteRule ^/(.*)$ index.php?q=$1 [L,QSA]

The first call to `mod_rewrite` within the _VirtualHost_ scope will as
expected change to But, the second call in
the _Directory_ does not seems to work and calling will throw a 404 error.

Here is the result in the log file:

(2) init rewrite engine with requested uri /test
(3) applying pattern '^/(.*)' to uri '/test'
(4) RewriteCond: input='' pattern='!^www\.example\.com
$' [NC] => not-matched
(1) pass through /test
(3) [perdir /var/www/example/] strip per-dir
prefix: /var/www/example/test -> test
(3) [perdir /var/www/example/] applying pattern '^/(.*)$' to uri 'test'
(1) [perdir /var/www/example/] pass through /var/www/test/test
File does not exist: /var/www/test/test

What did I miss?


To unsubscribe, e-mail:
For additional commands, e-mail: