【问题标题】:change to string url php更改为字符串 url php
【发布时间】:2012-06-04 02:01:13
【问题描述】:

你好吗?

我想改变我网站的链接,因为它很丑,我希望它像wordpress一样,我不知道如何改变它,所以请你帮助我

http://example.com/?id=43434 => http://example.com/?category=sport

怎么改成:

http://example.com/post/43434 => http://example.com/category/sport

谢谢

【问题讨论】:

    标签: php mod-rewrite


    【解决方案1】:

    你可以这样做,

    RewriteEngine on
    RewriteRule ^post/(\d+) index.php?id=$1 [L]
    RewriteRule ^category/([a-zA-Z0-9]+) index.php?category=$1 [L]
    

    我还推荐使用 php 框架。它们使使用漂亮的网址变得容易。您可以从 codeigniter 开始。

    另外,这是一篇适合初学者的好文章:http://www.workingwith.me.uk/articles/scripting/mod_rewrite

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-22
      • 1970-01-01
      相关资源
      最近更新 更多