2015-12-23 41 views
1

我正在使用RedirectMatch 301將請求(如mydomain.com/twitter)重定向到我的Twitter頁面。對於我正在用我的.htaccess文件下面的代碼:RedirectMatch排除某個目錄

RedirectMatch 301 (?i)/whatever http://thedomain.com 

的是,這樣的重定向是不區分大小寫的(我?)。我現在想要實現的是,只有在/ mydomain.com之後直接放置時,mydomain.com/sub/sub/whatever纔會重定向用戶。

在此先感謝

回答

1

使用正則表達式錨來限制你的對手:

RedirectMatch 301 ^(?i)/whatever/?$ http://thedomain.com 
+1

謝謝!那樣做了 – manuelgu