【问题标题】:How to rewrite multiple parameter url如何重写多个参数url
【发布时间】:2015-02-22 13:35:21
【问题描述】:

我在 url 重写方面遇到了一些问题。 我有这样的网址:

http://url.com/?page=post&id=1&title=astanadaghy-qorghanys-ministrliigiiniinh-janyndaghy-jarylys-jayly-janha-aqparat

我想要这样的东西:

http://url.com/posts/1-astanadaghy-qorghanys-ministrliigiiniinh-janyndaghy-jarylys-jayly-janha-aqparat.html

怎么做?

【问题讨论】:

    标签: .htaccess url url-rewriting


    【解决方案1】:

    在您的 .htaccess 文件中

    RewriteEngine On
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^/?posts/([0-9]+)-([^\.*]+).html$ index.php?page=post&id=$1&title=$2 [L,QSA]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-03
      • 2016-07-29
      • 1970-01-01
      • 2011-02-12
      相关资源
      最近更新 更多