The complete .htaccessfile

RewriteEngine on
RewriteBase /

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



redirects to:


The rule works fine on my test machine.

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

|- main.php
    |- new.inc.js


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 :()

  • 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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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