.htaccess重定向/foo.html到newsite.com/foo/ - 将.html重定向到wordpress帖子样式的网址

时间:2015-03-23 20:33:23

标签: wordpress .htaccess redirect

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

我试图将.htaccess中的旧页面映射为

Redirect 301 /foo.html http://www.newsite.com/foo/

但他们决心

http://www.newsite.com/foo.html?q=foo.html

发出404错误。

我的语法有什么问题吗?

1 个答案:

答案 0 :(得分:0)

(1)使用重定向我需要注释掉所有重写命令。重新定向和重写不应该像我从here那样学到的。

(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]

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

相关问题