簡體   English   中英

.htaccess將所有內容重寫為index.php,但特定文件夾中的腳本除外

[英].htaccess rewrite everything to index.php except scripts in a specific folder

我有兩個可公開訪問的文件夾:

/public
/legacy

現在,我希望將所有請求重定向到/public/index.php,但以/ legacy開頭的請求除外:

/users --> /public/index.php
/legacy/somescript.php --> /legacy/somescript.php

目前,我只有以下.htaccess文件:

/:

Order deny,allow
Deny from all

/ public和/ legacy:

Order allow,deny
Allow from all

您可以嘗試使用此mod_rewrite規則

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/(legacy/.*)$
RewriteRule . /public/index.php [L]

暫無
暫無

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

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