【发布时间】:2013-06-11 22:05:28
【问题描述】:
难看的网址是/profile.asp?ID=18751&BN=Starbright Property Care
我希望它是
/starbright_property_care
有人知道规则是什么吗?
【问题讨论】:
难看的网址是/profile.asp?ID=18751&BN=Starbright Property Care
我希望它是
/starbright_property_care
有人知道规则是什么吗?
【问题讨论】:
如果要将/starbright_property_care 转换为/profile.asp?ID=18751&BN=Starbright Property Care,ID 参数将丢失。这对于性能来说不是一个很好的主意。
如果您仍然想这样做,请使用 .htaccess 和以下代码:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ /profile.asp?BN=$1 [L]
在你的 PHP 中:
$bn = ucwords(str_replace('_',' ',$_GET['BN']));
【讨论】: