1

htaccess 中有这个正则表达式:

RewriteRule ^collection/([^/_]+)games/$ some.php?coll=$1 [L]  

它适用于像“/collection/somegames/”这样的
url,但我希望规则接受这些 url:“/collection/some-games/”被重定向到“some.php?coll=some”,我将其更改为:

RewriteRule ^collection/([^/_]+)-games/$ some.php?coll=$1 [L]   

或者

RewriteRule ^collection/([^/_\-]+)-games/$ some.php?coll=$1 [L] 

以上都没有帮助。
解决办法是什么?

4

1 回答 1

2
RewriteRule ^collection/([^/_]+?)-?games/$ some.php?coll=$1 [L]

你去吧。

于 2012-09-19T11:09:09.167 回答