【发布时间】:2014-06-20 13:26:06
【问题描述】:
我刚刚在 OSX 10.9 上设置了一个 AMP 服务器,但遇到了一个奇怪的问题,该问题在我的实时托管服务器或旧 WAMP 服务器上不存在。
我想将任何不直接映射到服务器上文件的 URL 重定向到 index.php。我正在使用以下 .htaccess 代码
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# prevent loop
RewriteCond %{REQUEST_URI} !index\.php
RewriteRule ^(.*)$ /index.php?/$1 [L]
当我尝试http://example.com/example时没有问题,但是当我引入另一个斜线时,例如http://example.com/example/
我收到 404 错误 The requested URL /example.html/ was not found on this server.
服务器版本:Apache/2.2.26 (Unix)
【问题讨论】:
标签: macos apache .htaccess mod-rewrite apache2