php - 如何在 .htaccess 的帮助下在 php 中重定向多个文件
问题描述
<!-- multiple redirection of file is not working -->
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)$ category.php?catname=$1 [L,N]
RewriteCond %{QUERY_STRING} !-d
RewriteCond %{QUERY_STRING} !-f
RewriteRule ^(.*)$ fullview.php?view=$1 [L]
<!--end -->
解决方案
只需替换您的根文件夹
RewriteEngine on
RewriteBase /Your root folder name
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
推荐阅读
- vue.js - 如何专注于 vuejs 中的 v-for 中的输入
- python - 在 tkinter 树视图中合并节点
- python - 如何为 sklearn 多类 ROC-AUC 分数使用不同的标签顺序?
- php - 诗篇检查“死亡”的呼唤
- reactjs - 根据使用的语言更改密钥
- json - 转换json对象时找不到类型转换器?
- terraform - terraform 如何确定何时下载模块?
- jsf - 在托管 bean 上执行资源注入时发生错误
- floating-point - 如何在单精度浮点中无偏差地转换负指数
- javascript - 使用 JavaScript addEventListener 到按钮