.htaccess redirect/foo.html到newsite.com/foo/-redirect.html到wordpress post样式的url

.htaccess redirect/foo.html到newsite.com/foo/-redirect.html到wordpress post样式的url,wordpress,.htaccess,redirect,Wordpress,.htaccess,Redirect,编辑:问题已解决,请参阅评论。原始帖子:我需要将/foo.html重定向到newsite.com/foo/,因为新网站是在wordpress中构建的,使用/page/-style permalinks 我尝试将旧页面映射到.htaccess中,例如 Redirect 301 /foo.html http://www.newsite.com/foo/ 但他们决心 http://www.newsite.com/foo.html?q=foo.html 给出一个404错误 我的语法有什么问题吗 (1

编辑:问题已解决,请参阅评论。原始帖子:我需要将/foo.html重定向到newsite.com/foo/,因为新网站是在wordpress中构建的,使用/page/-style permalinks

我尝试将旧页面映射到.htaccess中,例如

Redirect 301 /foo.html http://www.newsite.com/foo/
但他们决心

http://www.newsite.com/foo.html?q=foo.html
给出一个404错误

我的语法有什么问题吗

(1)使用重定向,我需要注释掉所有重写命令。重定向和重写不应该像我从中学到的那样结合在一起

(2) 使用重定向并不是将页面从旧站点映射到新站点的最佳实践,因为我无法提供回退。因此,我转而重写语句:

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} .
# mapping old pages to new site:
RewriteRule ^page.html$ http://www.newsite.de/page/ [R=301,L]
#...some more statements like the above
# last one, fallback:
RewriteRule .* http://www.newsite.de/ [R=301,L]

…以防万一其他人偶然发现了我的问题

你给了我一个提示:我必须在.htaccess中注释掉过时的重写规则,该规则已在旧网站上使用CMS,用于SEO友好的URL。我以为apache会在匹配重定向规则后退出.htaccess,-显然不是这样。现在可以了。谢谢,对给您带来的不便表示抱歉。很高兴这对您有帮助。