0

我有以下.htaccess文件:

RewriteEngine On
RewriteBase /
RewriteRule ^plugins/.* pluginLoader.php [L]
RewriteRule ^settings\.php index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} \.art$ [OR]
RewriteCond %{REQUEST_FILENAME} /system/
RewriteRule .* index.php [L]

它按预期工作,直到 URL 指向plugins目录中没有扩展名的现有文件的名称。我不知道为什么。例如有一个/plugins/invoice/name.txt文件。

http://localhost/plugins/invoice/name.txt
   uses pluginLoader.php as expected
http://localhost/plugins/invoice/name.
   uses pluginLoader.php as expected
http://localhost/plugins/invoice/name
   uses index.php! Why?
http://localhost/plugins/invoice/nam
   uses pluginLoader.php as expected

这同样适用于所有具有.txt.php扩展名的文件。如果文件有.sql扩展名,它既不使用pluginLoader.php也不使用index.php. 它发送404 - 未找到

有预处理器吗?

还有什么有趣的:

RewriteEngine On
RewriteBase /
RewriteRule ^plugins/.* pluginLoader.php [L]
RewriteRule ^settings\.php index.php [L]

删除最后四行使其工作。但是 URLhttp://localhost/plugins/invoice/fill仍然出现 404 错误。重命名文件后,URL 将起作用。

神秘...

4

1 回答 1

0

用这个替换你的 .htaccess 代码,看看是否有帮助:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^plugins/ pluginLoader.php [L,NC]

RewriteRule ^settings\.php/?$ index.php [L,NC]

RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} \.art$ [OR]
RewriteCond %{REQUEST_FILENAME} /system/
RewriteRule ^ index.php [L]

$DOCUMENT_ROOT/plugins确保目录中没有 .htaccess 。

于 2012-05-30T16:49:10.613 回答