php - 如何编写具有两个入口点的简单 .htaccess
问题描述
我在尝试使用下面的 .htaccess 文件来指导我的请求时遇到问题。每一个都从 rest 到 rest.php 和其他到 index.php 开始。问题是所有请求都指向 index.php,即使是从休息开始的请求。我错过了什么 ?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^rest(.+)$ rest.php? [QSA,L]
RewriteRule ^(.+)$ index.php? [QSA]
解决方案
下面的 .htaccess 似乎解决了我的问题,如果有错误,请在评论中写出来。
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^rest$ rest.php? [QSA,L]
RewriteRule ^rest(.+)$ rest.php? [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php? [QSA]
推荐阅读
- php - Laravel Echo Server 给出错误未处理错误事件:错误:连接 ECONNREFUSED
- html - Swift:NSAttributeString 不正确的 HTML 结果
- javascript - 返回承诺的Javascript顺序函数
- php - 数据库已连接,但数据未存储在 xamp 服务器中
- android - 切换到多窗口模式时,我的 Android 应用程序崩溃
- ios - iOS当按下按钮“下一步”加载新行表单解析Swift
- python - Python中各种数据库的单一API
- java - 从 Fragment 中的 Adapter 获取 imageview
- git - git clone 或通过慢速网络拉取一个巨大的 repo 以致命的 EOF 结束
- dataframe - Deedle F# - 查找索引组中的最大行数