首页 > 解决方案 > 如何在 .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 -->

标签: php.htaccess

解决方案


只需替换您的根文件夹

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]

推荐阅读