CakePHP の場合、デフォルトで、下記のような URL書き換えのルールが定義されています。
app/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
これらのルールにより、実在するディレクトリやファイルと同じ名前の場合、ディレクトリやファイルが優先されて、php は実行されません。
どうしても 実在するディレクトリと同じ名前にする必要があるのであれば、一致する条件をデフォルトの条件の前にすべて記載して対応するしかないと思います。
例:
/info
で終わる場合と /info/1
, /info/100
, /info/001
等の /info/数字
の場合は、 CakePHP の index.php を呼び出して処理する。
それ以外は、デフォルトのルールのまま。
app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/info$
RewriteRule ^(.*)$ index.php [QSA,L]
RewriteCond %{REQUEST_URI} ^/info/(\d+)$
RewriteRule ^(.*)$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>