更新时间:2023-02-23 10:36:25
我有罪书面code超过2年前的:P
I am guilty of writing that code more than 2 years back :P
这可以通过这个code被无限简化为:
That can be hugely simplified by this code:
# remove spaces from start or after /
RewriteRule ^(.*/|)[\s%20]+(.+)$ $1$2 [L]
# remove spaces from end or before /
RewriteRule ^(.+?)[\s%20]+(/.*|)$ $1$2 [L]
# replace spaces by - in between
RewriteRule ^([^\s%20]*)(?:\s|%20)+(.*)$ $1-$2 [L,R]
PS:必须补充一点,你需要修复这些URL还的来源,因为它实在是不正常的情况下获得的URL像这样
PS: Must add that you need to fix the source of these URLs also because it is really not normal to be getting URLs like this.