0

Please help, how to make this url (in my request i use get function)

iplookup.php?lookup_ip=66.249.66.1

to looks like this?

/ip/66.249.66.1

with

RewriteCond %{QUERY_STRING} lookup_ip=
RewriteRule ^ip/(.*)$ iplookup.php?lookup_ip=$1 [QSA]

But unsuccessful :(

4

1 回答 1

0

摆脱这种状况。RewriteCond %{QUERY_STRING} lookup_ip=条件只有在查询字符串中才为真,lookup_ip=而且显然 URI/ip/66.249.66.1没有。您的规则应如下所示:

RewriteRule ^ip/(.*)$ /iplookup.php?lookup_ip=$1 [L,QSA]

然后,当您请求时http://yourdomain.com/ip/12.34.56.78,浏览器的 URL 地址栏保持不变,而您在/iplookup.php?lookup_ip=12.34.56.78. 您只需要确保所有链接看起来像http://yourdomain.com/ip/12.34.56.78.

于 2012-12-27T10:39:37.437 回答