2011-03-11 75 views
1

我需要重定向頁面這樣extention:重定向頁面,而無需使用htaccess的

http://www.example.com/index.php

要這樣:

http://www.example.com/home 

這可能使用htaccess的?如果答案是肯定的,怎麼樣?

+0

您確定要重定向嗎,而不是「好的網址」? – 2011-03-11 10:27:44

+0

所以,你真正的意思是,你想要www.example.com/home重定向到www.example.com/index.php – 2011-03-11 10:44:45

回答

1

是的,這是可能的。把下面的代碼在你的.htaccess文件:

RewriteEngine on 

RewriteRule ^home$ index.php


看一看this website。這是一個很好的參考。

+0

@Michiel我想顯示像www.example.com/home這樣的網址,但是這個頁面被重定向to index.php – VKGS 2011-03-11 10:31:36

+0

@Sekar:對不起。你必須以相反的方式放置代碼。我編輯了我的答案。 – 2011-03-11 10:32:49

+0

@Michiel非常感謝。但我沒有錯誤。它會顯示「在此服務器上未找到請求的URL/projects/PageNotFound」。我已經把這個文件放在這個url裏會是這樣的http://localhost/projects/index.php – VKGS 2011-03-11 10:43:17