【问题标题】:Rewriting a dynamic link重写动态链接
【发布时间】:2013-06-11 22:05:28
【问题描述】:

难看的网址是/profile.asp?ID=18751&BN=Starbright Property Care

我希望它是

/starbright_property_care

有人知道规则是什么吗?

【问题讨论】:

    标签: url rewrite rule


    【解决方案1】:

    如果要将/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']));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-13
      • 1970-01-01
      • 1970-01-01
      • 2010-12-31
      相关资源
      最近更新 更多