RewriteRule ^Buy'-(.*)-b(.*)'.html productdetails.php?bname=$1&bid=$2
如果$bname = "Time to go shopping"或$bname = "Time to go: shopping", .htaccess中的上述代码工作正常。并给出了以下链接http://www.yourdomain.com/Buy-Time去购物-b1.html或http://www.yourdomain.com/Buy-Time浏览:shopping-b1.html
但是如果$bname = "Time: to go shopping",上面给出了一个不好的链接。Buy-time: to go shopping-b1.html
所以看来你的问题只是Buy-
在正则表达式vs buy-
在下一个URL的情况下。如果是这样,那么您只需要无大小写[NC]
标志:
RewriteRule ^Buy'-(.*)-b('d+)'.html ...?bname=$1&bid=$2 [NC]
我还冒昧地添加了'd+
,以明确。