Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The complete .htaccessfile

RewriteEngine on
RewriteBase /

RewriteRule ^([a-z0-9_\-]+)/([a-z0-9_\-]+)/(index\.php)?$ /main.php?type=$1&action=$2 [NC,QSA,L]

so,

www.server.com/users/new/

redirects to:

www.server.com/main.php?type=users&action=new

The rule works fine on my test machine.


However,
on another machine, it fails if there is a file that starts with the same name:

/
|- main.php
|
+--[users]
    |- new.inc.js

requesting

www.server.com/users/list/       --> 200 OK (main.php returns results as expected)
www.server.com/users/new/        --> 404 Not Found

If I remove `new.inc.js' the request will be redirected as expected.

What configuration flag causes this behaviour?
(I've been banging my head against the wall for some time now)

Update (I added the complete .htaccess file contents) index.html and index.php are the directory indexes

(And it does not make sense to me either :()

share|improve this question
    
Doesn't make sense to me yet from the information presented. Are there other RewriteRules? Is index.php set as the default index file? –  Devin Ceartas Aug 21 '09 at 16:52
    
Just to be clear, requesting www.server.com/users/new/ when <ROOT_DIR>/users/new/new.inc.js exist give a 404 error ? Could you enable rewrite log and give us the result ? (httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritelog) –  radius Aug 21 '09 at 18:08
    
@radius: <document_root>/users/new.inc.js exists. Unfortunately I can't enable anything. It took a lot of talking for me to get read access to the config files. –  Jacco Aug 21 '09 at 20:23
add comment

1 Answer

up vote 3 down vote accepted

Do you have mod_negotiation installed? If so, that'll take your request for new and try to work out what file you really meant to send. Make sure you don't have Options MultiViews set. So, in the .htaccess put Options -MultiViews.

share|improve this answer
    
Thanks, right on target. –  Jacco Aug 21 '09 at 20:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.