【发布时间】:2013-10-24 17:30:44
【问题描述】:
我已经在我的系统上安装了 WAMPSERVER。在 htdocs 文件夹中,我有一个名为“在线商店”的项目文件夹
所以要访问我写的项目
http://localhost/online-store
我想要所有类似的请求
http://locahost/online-store/products/2 or http://localhost/online-store/products/
被重定向到 api.php。 我已经为此编写了 htaccess 代码,但它说
/online-store/products url was not found on the system.
我正在重写 htaccess 以使其成为一个宁静的 API。 以下是我的 HTACCESS 代码。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)$ api.php?request=$1 [QSA,NC,L]
</IfModule>
【问题讨论】:
标签: php regex apache .htaccess mod-rewrite