簡體   English   中英

htAccess重定向所有.php除assets文件夾

[英]htAccess redirect all .php except assets folder

我想用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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM