You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Chad Day <cd...@atpco.com> on 2002/12/04 19:43:42 UTC

[users@httpd] mod_rewrite issues [ongoing, retitled]

view.php certainly exists.  no matter what file I go to in that domain, it
starts looping, even if I just go to http://calendar.domain.com, which would
load up index.php by default.  It matches, goes to view.php, then the
request on view.php also matches, begin loop.

Chad

> [calendar.domain.com/sid#80b7a04][rid#813b034/initial] (1) redirect to
> http://calendar.domain.com/view.php?ID=/cday2 [REDIRECT/302]


>> [calendar.domain.com/sid#80b7a04][rid#813b034/initial] (4) RewriteCond:
>> input='/view.php' pattern='!-f' => matched
>> RewriteEngine on
>> RewriteCond %{REQUEST_FILENAME} !-f
>> RewriteRule ^(.+) /view.php?ID=$1 [R,L,NE]
>Well, does view.php exist in the DocumentRoot?  You can easily exclude
>view.php explicitly by using another RewriteCond, but the question is, is
>the -f test working at all, or is it always returning false?


---------------------------------------------------------------------
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 issues [ongoing, retitled]

Posted by Joshua Slive <jo...@slive.ca>.
On Wed, 4 Dec 2002, Chad Day wrote:

> view.php certainly exists.  no matter what file I go to in that domain, it
> starts looping, even if I just go to http://calendar.domain.com, which would
> load up index.php by default.  It matches, goes to view.php, then the
> request on view.php also matches, begin loop.

I know.  What I'm suggesting is to put in a specific RewriteCond that
excludes view.php (testing on REQUEST_FILENAME or REQUEST_URI).  The you
will be able to test with other files to see whether -f is failing
entirely.

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


[users@httpd] RE: mod_rewrite issues [ongoing, retitled]

Posted by Chad Day <cd...@atpco.com>.
I see.  I think I found the problem, I have to specity the full document
root path in the RewriteCond, even though the DocumentRoot is correct.  So
now I have:

<VirtualHost calendar.domain.com>
DocumentRoot /usr/local/www/vhosts/domain.com/htdocs/calendar
DirectoryIndex index.php
ServerName calendar.domain.com
RewriteLogLevel 9
RewriteLog /usr/local/www/sites/domain.com/logs/rewrite_log
LogFormat COMBINED
ErrorLog /usr/local/www/sites/domain.com/logs/error_log
TransferLog /usr/local/www/sites/domain.com/logs/access_log
RewriteEngine on
RewriteCond
/usr/local/www/sites/domain.com/htdocs/calendar/%{REQUEST_FILENAME} !-f
RewriteRule ^(.+) /view.php?ID=$1 [R,L,NE]
</VirtualHost>

This -almost- works.  It redirects correctly, but with the leading slash
problem:

http://calendar.domain.com/cday goes to:

http://calendar.domain.com/view.php?ID=/cday

but like I mentioned, I can strip that off in PHP.  The only other issue I
have is requests to:

http://calendar.domain.com or
http://calendar.domain.com/

go to :

http://calendar.domain.com/view.php?ID=/

In the rewritelog file:

206.181.245.167 - - [04/Dec/2002:15:48:01 +0000]
[calendar.domain.com/sid#80f2a04][rid#813b034/initial] (2) init rewrite
engine with requested uri /
206.181.245.167 - - [04/Dec/2002:15:48:01 +0000]
[calendar.domain.com/sid#80f2a04][rid#813b034/initial] (3) applying pattern
'^(.+)' to uri '/'
206.181.245.167 - - [04/Dec/2002:15:48:01 +0000]
[calendar.domain.com/sid#80f2a04][rid#813b034/initial] (4) RewriteCond:
input='/usr/local/www/sites/penguinleagues.com/htdocs/calendar//'
pattern='!-f' => matched

It doesn't seem to be picking up the directory index (even after I added the
DirectoryIndex line in the vhost, which I don't think was necessary as it
was defined earlier and works fine everywhere else).  I noticed that 2nd /
in the last line of the log, and changed the RewriteCond to:

RewriteCond
/usr/local/www/sites/domain.com/htdocs/calendar%{REQUEST_FILENAME} !-f

but the same problem for the DocumentIndex still exists.  Do I need to write
another rule specifically to handle DocumentIndex requests, or did I do
something else wrong?

Thanks,
Chad

>> view.php certainly exists.  no matter what file I go to in that domain,
it
>> starts looping, even if I just go to http://calendar.domain.com, which
would
>> load up index.php by default.  It matches, goes to view.php, then the
>> request on view.php also matches, begin loop.

>I know.  What I'm suggesting is to put in a specific RewriteCond that
>excludes view.php (testing on REQUEST_FILENAME or REQUEST_URI).  The you
>will be able to test with other files to see whether -f is failing
>entirely.



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