2011-03-15 85 views
0

嘿,這裏是我有一個問題的例子。我有一個鏈接:url rewrite question

<a href='/index.php'>link</a> 

這將反過來去domain.com/index.php

現在我怎麼會讓如此,與URL重寫,它不index.html的後顯示?

我知道我只能用「/」鏈接到文檔根目錄,但這不適用於所有情況。所以簡單的重寫會非常棒!

+0

不應該需要改寫:只是鏈接到'domain.com' – 2011-03-15 07:41:35

回答

0
RewriteEngine On 
RewriteRule ^index.php$/[R=301,L] 
+1

OK,這是更優雅;-) – konsolenfreddy 2011-03-15 07:45:44

+0

完美,謝謝! – smither 2011-03-15 07:54:29

0

你也可以強制,如果你不能影響鏈接像@Pekka建議

RewriteCond %{REQUEST_URI} ^/index\.php$ 
RewriteRule ^(.*)$ http://domain.com [R=301,NC,L]