2013-07-31 12 views
0

我使用ExpressionEngine,它是產生這樣的URL查看特定類別時:如何爲.htaccess 301重定向只有當最終URL段是空

domain.com/index.php/template_group/ template/category_URL_indicator/foo_category/

我想重定向訪問者,如果他們從URL的最後一段刪除特定類別。舉例來說,如果他們做了這個網址:

domain.com/index.php/template_group/template/category_URL_indicator/

我試着一個.htaccess 301重定向,但重定向的URL縮短也重定向的URL更長。也就是說,如果我把這個在.htaccess:

redirect 301 http://www.domain.com/index.php/template_group/template/category_URL_indicator http://www.domain.com 

這也重定向的URL更長成爲http://www.domain.com/foo_category/ - 不被需要什麼...任何建議表示歡迎 - 謝謝!

David。

回答

0

嘗試使用重定向匹配代替,隨着開始/結束邊界:

redirect 301 ^index.php/template_group/template/category_URL_indicator$ http://www.domain.com