2013-10-22 105 views
0

我想在我的網站上使用友好的網址。URL重寫不變URL

基本上,我希望www.example.com/index.php?view=contact顯示爲www.example.com/view/contact - 將聯繫人更改爲各種其他頁面。

這裏是我拼湊起來的.htaccess文件:

RewriteEngine on 
RewriteRule ^view/([^/\.]+)/?$ /view=$1 [L] 

雖然,這是行不通的。有什麼建議麼?

Mod_rewrite已打開,我可以將其更改爲www.example.com/contact/。

+0

apache如何在'www.example.com/view = contact'上工作? – hjpotter92

+0

apache config的mode_rewrite –

+0

你想'www.example.com/view = contact'或'www.example.com/?view = contact'? – anubhava

回答

0

似乎您的查詢字符串缺少問號。 試試這個 RewriteEngine on RewriteRule ^view/([^/\.]+)/?$ /?view=$1 [L]

+0

這沒有奏效。我也試過RewriteRule^view /([^/\.]+)/?$ /index.php?view=$1 [L] – user2905584