2011-11-26 69 views
0

我正在製作一個.htaccess文件與各種mod_rewrite規則。目前,我的規則之一是.htacess mod-rewrite正則表達式

RewriteRule ^blog /directorypath/index.php [L]

但是,當您鍵入 http://www.mysite.com/blogfjdkkfnfdjn時,它仍然加載 blog頁面。

基本上,我正在尋找的正則表達式它加載時JUST`/ blog`在鍵入的博客,並沒有別的

回答

0

如果通過/blog/blog/訪問你的博客,然後我會用

RewriteRule ^blog/?$ /directorypath/index.php [L] 
0

$字符添加到表達

RewriteRule ^blog$ /directorypath/index.php [L]

0
RewriteRule ^blog$ /directorypath/index.php [L] 
1

您可以使用:

Redirect permanent /blog /directorypath/index.php 

如果你需要一個臨時的,你可以使用:的302代替permanent

OR

RewriteRule ^blog/?$ /directorypath/index.php [R=301,L] 

如果你需要一個臨時的,你可以使用:R=302