我有一个目录,其中列出了http://example.com/residencies/当您单击它链接到的住所时我们拥有的所有住所http://example.com/residencies/myhouse现在我需要 .htaccess 将地址重写为http://example.com/residencies/details.php?id=myhouse
我有
RewriteCond %{QUERY_STRING} !(?:^|&)id= [NC]
RewriteRule ^residencies/(.+)$ /residencies/details.php?id=$1 [QSA]
这将进行重定向,但也尝试重定向http://example.com/residencies/ 到http://example.com/residencies/details.php?id= 给出错误的内容我如何使它忽略重写规则是否没有 id?