我有一个应用程序需要目录中/tileserver/
包含以下内容的 htaccess 文件:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(tileserver\.php)
RewriteRule ^(.*)$ tileserver.php?/$1 [L,QSA]
我需要的是针对 tileserver 的任何 URL 请求/
而是
tileserver/tileserver.php/
但如果我添加类似以下内容:
RewriteRule ^tileserver/(.*)$ tileserver/tileserver.php/$1
没有效果。我该如何编写此规则?
更新这是错误日志中的一行:
[Thu Dec 17 13:17:48.858560 2015] [negotiation:error] [pid 23573] [client 108.44.58.67:64411] AH00687: Negotiation: discovered file(s) matching request: /var/www/html/tileserver/extra5 (None could be negotiated)., referer: http://107.170.120.88/tileserver/
答案1
请求将以 开头,/
因此您需要将其更改为
RewriteEngine On
RewriteRule ^/tileserver/(.*)$ /tileserver/tileserver.php/$1 [L]