gpt4 book ai didi

php - htAccess 重定向除 Assets 文件夹之外的所有 .php

转载 作者:行者123 更新时间:2023-12-04 17:59:47 27 4
gpt4 key购买 nike

我想使用 htaccess 将所有 .php 脚本重定向到 index.php。/assets/文件夹中的脚本除外。

例如:

   /test.php                         ->    /index.php
/folder/test.php -> /index.php
/assets/test.php -> /assets/test.php
/assets/folder/folder/test.php -> /assets/folder/folder/test.php

这是我当前的 htaccess 文件:

RewriteEngine on
RewriteCond %{REQUEST_URI} !(\.png|\.jpg|\.gif|\.jpeg|\.bmp|\.css|\.js|\.woff|\.woff2|\.map|\.ico|\.map)$
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

最佳答案

找到答案...

将此添加到 .htaccess:

RewriteCond %{REQUEST_URI} !^(/assets)

关于php - htAccess 重定向除 Assets 文件夹之外的所有 .php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36912316/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com