使用正则表达式会有更简单的方法吗?
RewriteRule ^2090024$ https://www.wsjwine.com/discovery_offer.aspx?promo=2090024 [L]
RewriteRule ^2090025$ https://www.wsjwine.com/discovery_offer.aspx?promo=2090025 [L]
RewriteRule ^2090013$ https://www.wsjwine.com/discovery_offer.aspx?promo=2090013 [L]
RewriteRule ^2078027$ https://www.wsjwine.com/discovery_offer.aspx?promo=2078027 [L]
RewriteRule ^2078028$ https://www.wsjwine.com/discovery_offer.aspx?promo=2078028 [L]
RewriteRule ^2078029$ https://www.wsjwine.com/discovery_offer.aspx?promo=2078029 [L]
RewriteRule ^2078030$ https://www.wsjwine.com/discovery_offer.aspx?promo=2078030 [L]
我觉得有,但不太了解mod_rewrite。
答案 0 :(得分:1)
取决于您要接受的数字格式。如果仅仅捕获任何7位数字就足够了:
RewriteRule ^([0-9]{7})$ https://www.wsjwine.com/discovery_offer.aspx?promo=$1 [L]
如果它可以是任意数量的数字(不只是7):
RewriteRule ^([0-9]+)$ https://www.wsjwine.com/discovery_offer.aspx?promo=$1 [L]