Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite - conflict with some other module?

         

mechanick

12:59 pm on Nov 21, 2011 (gmt 0)

10+ Year Member



Hi,

I can't find solution for this problem:

FIGURE A - work correctly as expected

script & folder structure:

.htaccess
index.php
sample.htm

.htaccess content:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^folder/([^/\.]+)\.htm$ index.php?url=$1 [DPI]

call url: /folder/test.htm
expected result: displaying content of index.php
result: correct

FIGURE B - and problem is here...

script & folder structure:

.htaccess
index.php
folder.htm

.htaccess content:
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^folder/([^/\.]+)\.htm$ index.php?url=$1 [L,DPI]

call url: /folder/test.htm
expected result: displaying content of index.php
result: error - 404 not found file /folder.htm/test.htm

RewriteLog:
add path info postfix: /var/www/test.com/folder.htm -> /var/www/test.com/folder.htm/test.htm
strip per-dir prefix: /var/www/test.com/folder.htm/test.htm -> folder.htm/test.htm

So, in case of existing file (folder.htm) with same name as rewrited folder (/folder/) come this error.

Possible problems and solutions:
1) "add path info postfix" error - DPI flag tried (apache 2.2.14 & 2.2.21) - no change;
2) dir module conflict (directorySlash off, AcceptPathInfo off) - no change;
3) speling module conflict - disabled module - no change;
4) alias module conflict - no alias using (at all) - no change;
5) rewriteBase used - no change;


This looks like some kind logical conflict in apache config (on this my specific server) - another server, using apache 2.2.9 (with no DPI, "add path info postfix" error) work CORRECTLY with top example (without DPI flag in rewriteRule, of course). I'm not able to find this conflict, correct setting.

Any idea of solution?

lucy24

10:38 pm on Nov 21, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Sit tight, mechanick, we are not ignoring you. We're accustomed to buying time with "RTFM" type responses, but your post doesn't leave room for this option, so it will take longer ;)

mechanick

9:34 pm on Nov 26, 2011 (gmt 0)

10+ Year Member



Time's up - solved

Main document root with option multiviews is really bad idea...
And if you place this to extra default conf file, which you don't check anymore, you can spend whole week with recompilling, testing, modifying, searching... and nothing.

my stupidity. sorry.

lucy24

12:50 am on Nov 27, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Been there. Done that. :)

Seriously, it's the "I don't have time to read the previous 500 identical threads so please write my code for me" posts that set people foaming at the mouth. Thanks for posting back with the solution.