-3

我如何.php在 url 末尾添加使用.htaccess以下是 .htaccess 代码

.htaccess

<IfModule mod_rewrite.c>
# Enable Rewriting
RewriteEngine on

RewriteRule ^search/(.*)/?$ search.php?loc=$1

</IfModule>

搜索.php

如果网址是

search.php?loc=miami

echo "Location : " . $_GET['loc'];

output: Location : miami

但到底怎么可能得到search.php/miami.php

4

1 回答 1

1
RewriteRule ^search\.php/(.+)\.php$ search.php?loc=$1
于 2012-05-25T13:35:53.490 回答