我有一个包含700多个重定向的htaccess文件,其中大多数都没有工作。我得到一个404页面,即使它们在同一个域上。这里有5个不起作用:
Redirect 301 /orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-1-person.html /fly-snooze-cruise/orlando-airport/
Redirect 301 /orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-2-people.html /fly-snooze-cruise/orlando-airport/
Redirect 301 /orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-3-people.html /fly-snooze-cruise/orlando-airport/
Redirect 301 /orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-4-people.html /fly-snooze-cruise/orlando-airport/
Redirect 301 /orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-5-people.html /fly-snooze-cruise/orlando-airport/
我检查了域名请告诉我我做错了什么。感谢所有帮助。
答案 0 :(得分:1)
您只能使用一个:
RewriteRule ^orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-\d+-person\.html$ /fly-snooze-cruise/orlando-airport [R=301,L]
答案 1 :(得分:0)
好的,我发现mod_rewrite部分中的重写规则与重定向有些混乱。所以我将" Redirect 301"转换为mod_rewrite.c中的重写规则,一切正常。
RewriteRule ^orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-1-person.html$ /fly-snooze-cruise/orlando-airport [R=301,L]
RewriteRule ^orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-2-people.html$ /fly-snooze-cruise/orlando-airport [R=301,L]
RewriteRule ^orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-3-people.html$ /fly-snooze-cruise/orlando-airport [R=301,L]
RewriteRule ^orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-4-people.html$ /fly-snooze-cruise/orlando-airport [R=301,L]
RewriteRule ^orlando-airport/fly-snooze-cruise-hotel-packages-orlando-airport-5-people.html$ /fly-snooze-cruise/orlando-airport [R=301,L]