httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Forrest <jlforr...@berkeley.edu>
Subject [users@httpd] Very Puzzling Question About mod_rewrite
Date Fri, 02 Nov 2007 00:13:34 GMT
(This is on Solaris 10-x86 with Apache 2.2.4)

When I give the URL

1)  http://www-demo.cchem.berkeley.edu/username/public_html

everything works fine. However, for historical reasons,
I can't require that people give the "/public_html" at
the end of the URL. In other words, I want users to
be able to enter

2) http://www-demo.cchem.berkeley.edu/username/

to see the same results as produced by URL #1 .
So, I decided to try mod_rewrite. I use the following
in the proper VirtualHost section of my httpd.conf file:

RewriteLogLevel 5
RewriteLog "/users/chemweb/apache2/logs/rewrite.log"
RewriteEngine on
RewriteRule  ^(.+)$  $1/public_html/      [L]

This doesn't work. The client sees a "403 Forbidden" message.
The apache log says:

"Directory index forbidden by Options directive: 
/users/chemweb/apache2/http-cchem/htdocs/username/public_html/"

I don't understand why I'm getting this message when
URL #1 above works.

The rewrite log shows the following (I added the #numbers):

#1 (2) init rewrite engine with requested uri /username/
#2 (3) applying pattern '^(.+)$' to uri '/username/'
#3 (2) rewrite '/username/' -> '/username//public_html/'
#4 (2) local path result: /username//public_html/
#5 (2) prefixed with document_root to 
/users/chemweb/apache2/http-cchem/htdocs/username/public_html/
#6 (1) go-ahead with 
/users/chemweb/apache2/http-cchem/htdocs/username/public_html/ [OK]
#7 (2) init rewrite engine with requested uri /username/index.html
#8 (3) applying pattern '^(.+)$' to uri '/username/index.html'
#9 (2) rewrite '/username/index.html' -> '/username/index.html/public_html/'
#10 (2) local path result: /username/index.html/public_html/
#11 (2) prefixed with document_root to 
/users/chemweb/apache2/http-cchem/htdocs/username/index.html/public_html/
#12 (1) go-ahead with 
/users/chemweb/apache2/http-cchem/htdocs/username/index.html/public_html/ 
[OK]

Line #6 above looks correct to me so I don't understand why mod_rewrite
tried the other possibilities.

I'm guessing all these problem have something to do with directory
protection but if this is true then I don't understand why URL #1
works.

Any ideas?

Cordially,
-- 
Jon Forrest
Unix Computing Support
College of Chemistry
173 Tan Hall
University of California Berkeley
Berkeley, CA
94720-1460
510-643-1032
jlforrest@berkeley.edu

---------------------------------------------------------------------
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


Mime
View raw message