2013-10-22 53 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