我有超过700的所有使用规则集重定向在htaccess文件。我无法搞清楚如何重定向多个页面的URL数字2-20。这里是我的非工作重定向:
I have over 700 redirects in a htaccess file all using RewriteRules. I'm having trouble figuring out how to redirect multiple pages with numbers 2-20 in the URL. Here are my non-working redirects:
RewriteRule ^orlando-airport/americas-best-cocoa-beach/1-person-fly-snooze-cruise-hotel-package.html$ /fly-snooze-cruise/orlando-airport/americas-best-cocoa/1-person [R=301,L]
RewriteRule ^orlando-airport/americas-best-cocoa-beach/[0-9]-people-fly-snooze-cruise-hotel-package.html$ /fly-snooze-cruise/orlando-airport/americas-best-cocoa/$1-people [R=301,L]
RewriteRule ^orlando-airport/double-tree-cocoa-beach/1-person-fly-snooze-cruise-hotel-package.html$ /fly-snooze-cruise/orlando-airport/doubletree-cocoa-beach/1-person [R=301,L]
RewriteRule ^orlando-airport/double-tree-cocoa-beach/[0-9]-people-fly-snooze-cruise-hotel-package.html$ /fly-snooze-cruise/orlando-airport/doubletree-cocoa-beach/$1-people [R=301,L]
线1和3的工作,但2和4没有。人在网址的数量应为1人,然后2-20人。任何帮助将是AP preciated
Lines 1 and 3 work but 2 and 4 don't. The number of people in the URLs should be 1 person and then 2-20 people. Any help would be appreciated
你没有捕捉前pression,而你只允许一个数字。
You're not capturing the expression, and you're only allowing one digit.
使用([0-9] +)
而不是 [0-9]
:
RewriteRule ^orlando-airport/americas-best-cocoa-beach/1-person-fly-snooze-cruise-hotel-package.html$ /fly-snooze-cruise/orlando-airport/americas-best-cocoa/1-person [R=301,L]
RewriteRule ^orlando-airport/americas-best-cocoa-beach/([0-9]+)-people-fly-snooze-cruise-hotel-package.html$ /fly-snooze-cruise/orlando-airport/americas-best-cocoa/$1-people [R=301,L]
RewriteRule ^orlando-airport/double-tree-cocoa-beach/1-person-fly-snooze-cruise-hotel-package.html$ /fly-snooze-cruise/orlando-airport/doubletree-cocoa-beach/1-person [R=301,L]
RewriteRule ^orlando-airport/double-tree-cocoa-beach/([0-9]+)-people-fly-snooze-cruise-hotel-package.html$ /fly-snooze-cruise/orlando-airport/doubletree-cocoa-beach/$1-people [R=301,L]