首页 文章

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

提问于
浏览
0

编辑: Problem solved, see comment. 原帖:我需要将 /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

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

    (2)使用Redirect不是将页面从旧站点映射到新站点的最佳实践,因为我无法提供回退 . 因此,我切换到Rewrite语句:

    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]
    

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

相关问题