Mod重写标签

时间:2013-05-28 18:08:52

标签: mod-rewrite url-rewriting rewrite

我的网址是这样的。 http://site.org/index.php?page=tags&tag=tagname

我想把它重写为

http://site.com/tags/tagname

我目前的.htaccess

RewriteEngine On

    # RewriteRule ^/?([a-z]+)$ $1.php [L]

    RewriteEngine on
    RewriteRule ^([A-Za-z0-9-_]+)$ index.php?paste=$1 [L]

    RewriteEngine on
    RewriteRule ^([A-Za-z0-9-_]+)/edit$ index.php?paste=$1&page=edit [L]

    RewriteEngine on
    RewriteRule ^([A-Za-z0-9-_]+).txt$ index.php?paste=$1&paste_txt=$1 [L]

    RewriteEngine on
    RewriteRule ^([A-Za-z0-9-_]+).txt$ index.php?paste=$1&paste_txt=$1 [L]

    RewriteEngine on
    RewriteRule ^([A-Za-z0-9-_]+)/delete$ index.php?paste=$1&page=delete [L]

    RewriteEngine on
    RewriteRule ^([A-Za-z0-9-_]+).download$ index.php?paste=$1&paste_download=$1 [L]

    RewriteEngine on
    RewriteRule ([^/\.]+)/?.cgi$ index.php?page=$1 [L]

    #RewriteEngine on
    #RewriteRule ([^/\.]+)/?.txt$ index.php?paste_txt=$1 [L]

    #RewriteEngine on
    #RewriteRule ([^/\.]+)/?.download$ index.php?paste_download=$1 [L]

1 个答案:

答案 0 :(得分:0)

RewriteRule ^/?([A-za-z0-9]+)/([A-za-z0-9]+)$ index.php?page=$1&tag=$2 [L]

我相信这应该这样做......那就是你想要标签中的数字。如果没有,请从每个部分删除0-9。