You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marc Wrubleski <ml...@math.ucalgary.ca> on 2002/11/26 19:11:47 UTC

[users@httpd] mod_rewrite behavior changed in apache 2.0

Hello List,

we have been using mod_rewrite for a few years as the mechanism to drive
our template based website. The rules are:

   RewriteEngine on
   RewriteRule .*\.tmpl.* - [L]
   Rewritecond %{REQUEST_FILENAME} \.(html|htm|php|php3)
   RewriteRule ([^?]*)$ /index.tmpl?page_name=$1&%{QUERY_STRING} [L]

Summed up: for any page of type .html, .htm, .php, .php3, instead of
loading that page directly, load the template file with the intended
page passed as the 'page_name' variable.

Now these rules work fine, my problem is the difference between how
Apache 1.3 and 2.0 handle the directoryindex. In 1.3, when apache
resolves the directoryindex, it gives the result to mod_rewrite via the
REQUEST_FILENAME and all is well. But in Apache2, while the
directoryindex is resolved properly, the REQUEST_FILENAME in mod_rewrite
is '', thus the rules fail and the intended directory index file is
loaded directly instead of by the template file.

Server version: Apache/2.0.43 on Solaris 8 on Sun

I am looking for ideas on how to revert the behavior in Apache 2.0 so
that my job is easy, but failing that, suggestions on how to implement
this given the described behavior. 

Thanks in advance.

Marc Wrubleski
Dept of Mathematics and Statistics
University of Calgary




---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite behavior changed in apache 2.0

Posted by Joshua Slive <jo...@slive.ca>.
On Tue, 26 Nov 2002, Marc Wrubleski wrote:

> Hello List,
>
> we have been using mod_rewrite for a few years as the mechanism to drive
> our template based website. The rules are:
>
>    RewriteEngine on
>    RewriteRule .*\.tmpl.* - [L]
>    Rewritecond %{REQUEST_FILENAME} \.(html|htm|php|php3)
>    RewriteRule ([^?]*)$ /index.tmpl?page_name=$1&%{QUERY_STRING} [L]


This is probably the same issue as discussed in
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8493
so you might want to add your comments there and add yourself to the cc
list.  A possible workaround would be to add the following:

Rewritecond %{REQUEST_FILENAME} ^$
RewriteRule  (.*) /index.tmpl?page_name=$1/index.html [L,QSA]
(or something like that)

(Incidentally, the [^?] and the &%{QUERY_STRING} are superfluous.
RewriteRule doesn't match against the query string, and the QSA option can
be used to tag the old query string on to the end.)

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org