簡體   English   中英

使用 htaccess 從 URL 中刪除最后一個目錄

[英]Remove last directory from URL using htaccess

我的問題是,如何使用 htaccess 規則刪除最后一個目錄。

http://mywedding.com/anandn/
should load content of
http://mywedding.com/anandn/theme/

OR

http://mywedding.com/mamtaandkuldip/
should load content of
http://mywedding.com/mamtaandkuldip/theme/ 

提前致謝。

將此規則放在DocumentRoot/.htaccess文件中:

RewriteEngine On

RewriteRule ^([^/.]+)/?$ /$1/theme/ [L]

在 mywedding.com/anandn/index.php 中寫入以下代碼 header("location:mywedding.com/anandn/theme/");

它會將您重定向到您的網站。

暫無
暫無

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

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