2014-03-25 37 views
2

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

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/ 

在此先感謝。

+0

只需用'/'替換'/(.*/)$'?美元使它成爲url的最後一部分 – Martijn

回答

2

將本規則中DocumentRoot/.htaccess文件:

RewriteEngine On 

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

當我輸入http://mywedding.com/anandn/時,它應該顯示http://mywedding.com/anandn/theme/ –

+0

的內容嗯你的問題與其相反。讓我改變它 – anubhava

+0

現在檢查更新的答案。 – anubhava

0

內 mywedding.com/anandn/index.php 寫下面的代碼 標題( 「位置:mywedding.com/anandn/theme/」) ;

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

+1

我不想改變URL我的朋友.... –

相關問題