【问题标题】:htAccess redirect all .php except assets folderhtAccess 重定向除资产文件夹之外的所有 .php
【发布时间】:2016-08-23 01:53:39
【问题描述】:

我想使用 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]

【问题讨论】:

    标签: php .htaccess redirect


    【解决方案1】:

    找到答案了……

    将此添加到 .htaccess:

    RewriteCond %{REQUEST_URI} !^(/assets)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-29
      • 1970-01-01
      • 1970-01-01
      • 2013-11-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 2012-12-07
      相关资源
      最近更新 更多