htaccess中有这个正则表达式:
RewriteRule ^collection/([^/_]+)games/$ some.php?coll=$1 [L]
它适用于url,如“/ collection / somegames /”
但我希望规则接受这些网址:“/ collection / some-games /”被重定向到“some.php?coll = some”
我将其更改为:
RewriteRule ^collection/([^/_]+)-games/$ some.php?coll=$1 [L]
或
RewriteRule ^collection/([^/_\-]+)-games/$ some.php?coll=$1 [L]
以上都没有帮助。
解决方案是什么?
答案 0 :(得分:2)
RewriteRule ^collection/([^/_]+?)-?games/$ some.php?coll=$1 [L]
你去。