.htaccess我想要重写字母 - 字母/数字中的数字

时间:2015-09-24 07:48:33

标签: apache .htaccess url mod-rewrite

http:/example.com/word-123 - > http://example.com/word/123

我试图以这种方式做但没有任何事情发生

RewriteCond %{HTTP_HOST} ^([a-z]+)/([0-9]+)$ 
RewriteRule ^([a-z]+)-([0-9]+)$ [P]

OR

RewriteRule  http://prink-it.adit.it/([a-z]+)-([0-9]+) [P]

2 个答案:

答案 0 :(得分:0)

根据我对你的问题的理解:

(SELECT COUNT(*) 
 FROM participants 
 WHERE `status` = 'a' 
   AND meetid = NEW.meetid) = (SELECT capacity 
                               FROM participants 
                               INNER JOIN rooms 
                                  ON pid = room 
                               WHERE room = NEW.pid)

答案 1 :(得分:0)

我以这种方式解决了

RewriteCond %{THE_REQUEST} GET\ /([a-z]+)\/(\d+) [NC]
RewriteRule ^ /%1-%2 [R=301,P]

RewriteRule ^([a-z]+)-(\d+)$ /$1/$2 [P]