.htaccess返回500错误的重写URL

时间:2016-09-25 08:36:52

标签: php apache .htaccess mod-rewrite

我尝试重写此网址

http://domain.com/page?LINK=member-name

http://domain.com/page/member-name

我试过的规则是:

RewriteEngine On
RewriteRule ^page/([^/]*)$ /page?LINK=$1 [L]

我这样称呼请求:

<a href="page/john-smith">John Smith</a>

1 个答案:

答案 0 :(得分:0)

试试这个,我假设页面有.php扩展名。

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^page/([^/]*)$ page.php?LINK=$1 [L]