.htaccess url重写没有传递参数 - 是否有某个地方的apache设置阻止了这个?

Okay, so this problem has completely stumped me and the other devs I work with. Here is the rundown:

I have a local dev environment setup with Mac Apache2 pointed at /Users/myusername/Sites/

Within /Sites I have two folders, /site-1 and /site-2, both of which have virtual hosts pointed at them site-1.dev & site-2.dev. Both site-1 and site-2 are running local installs of PerchCMS.

Within /site-2 I have an .htaccess file which I am trying to set up a URL rewrite that takes the URL /detail/slug-here and translates it into /detail.php?s=slug-here

I have tried the following rewrites (at the suggestion of PerchCMS support) and both have failed to pass the s param:

RewriteRule ^detail/([a-zA-Z0-9-/]+)$ detail.php?s=$1 [L]
RewriteRule ^site-2/detail/([a-zA-Z0-9-/]+)$ /site-2/detail.php?s=$1 [L]

Additional info:

  1. Yes mod_rewrite is enabled in apache... in the same .htaccess file it totally works if I do a simple rewrite like this...

    RewriteRule dangerzone.html index.php
    
  2. One odd behavior that I've noticed is that if I remove everything from .htaccess I can still pull up detail.php by pointing my browser at /detail/test-item-1...(yes I have restarted my server) so its behaving as if there is still some sort of rewrite in place and loading detail.php sans param just as it continues to do with the rewrite in place - is this a clue that there is something off somewhere else in my server config? Note, RewriteRule dangerzone.html index.php does NOT work once it is removed from .htaccess.

Have this code in your site root .htaccess (inside /site-2/):

Options -MultiViews
RewriteEngine On

RewriteRule ^detail/([a-zA-Z0-9/-]+)/?$ detail.php?s=$1 [L,QSA,NC]

Important is to turn off MultiViews options here. Option MultiViews is used by Apache's content negotiation module that runs before mod_rewrite and makes Apache server match extensions of files. So /file can be in URL but it will serve /file.php.