【发布时间】:2016-01-09 18:18:09
【问题描述】:
我在 Apache 2.4.10 (Debian) 上本地开发 Web 服务。
我想像这样使用 URL:http://localhost/ws/rest/users
其中 /ws/rest 是物理目录,users 是一个参数。
我写了以下 /var/www/html/ws/rest/.htaccess 文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^(.*)$ ws/rest/api.php?rquest=$1 [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ ws/rest/api.php [QSA,NC,L]
RewriteCond %{REQUEST_FILENAME} -s
RewriteRule ^(.*)$ ws/rest/api.php [QSA,NC,L]
</IfModule>
这个想法是将所有内部路径重定向到 api.php 文件,但是当我将浏览器指向上一个 URL 时,我总是收到“404 Not found”错误。
问题出在哪里?
【问题讨论】:
标签: apache .htaccess mod-rewrite