2014-11-05 60 views
1

我有以下htaccess文件:正確的方式來定義htacces網址

Rewriterule ^view_profile-(.*)$ view.php?user=$1 

當我這樣做"<a href="view_profile-John">View profile</a>它的偉大工程(URL看起來像:http://home.com/view_profile-John)不過,如果我試試這個:

Rewriterule ^view/profile-(.*)$ view.php?id=$1它說,網頁無法找到。

有誰知道爲什麼不工作?

+0

因爲在這種情況下鏈接應該是'HREF =「查看/型材約翰」' – vaso123 2014-11-05 16:53:56

+0

你能顯示完整的.htaccess? – anubhava 2014-11-05 16:59:00

回答

1

你可能需要打開在這裏關閉Multiviews。因爲請求的開頭看起來像/view/...,並且有一個文件/view.php,mod_negotiation會自動假定你的意思是php文件並在mod_rewrite之前將其路由到那裏,甚至有機會做任何事情。嘗試添加:

Options -Multiviews 
+0

哇,就是這樣。謝謝你的哥們 – Charles 2014-11-05 18:55:56