簡體   English   中英

將子目錄重定向到根子目錄,而無需更改URL PHP

[英]Redirect subdirectory to root subdirectory without changing url PHP

https://example.com/app1

這是我的子目錄,它在Apache服務器上運行一個index.html文件。

我需要在不更改URL的情況下將所有請求重定向到該目錄,例如https://example.com/app1/*https://example.com/app1

如果用戶訪問https://example.com/app1/test ,則應將其重定向到https://example.com/app1但URL應與https://example.com/app1/test保持相同

您可以在public_html/. htaccess使用此規則public_html/. htaccess public_html/. htaccess

RewriteEngine on

RewriteRule ^app1/((?!index\.html).+)$  /app1/ [NC,L]

Options +FollowSymlinks RewriteEngine on RewriteRule ^([a-zA-Z0-9_-]*)$ index.php [nc,qsa]

這個為我工作。

謝謝大家。

暫無
暫無

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

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