花了一天的时间在网上阅读数百个变体,但仍然找不到一个确切的答案来解决这个问题。
将旧域上的旧站点结构移动到新域上的新站点结构,因此我正在寻找最好的、搜索引擎友好的、重定向代码:
这是我的东西--而且它不起作用--谁能帮我改进一下吗?非常感谢!
RewriteEngine on
RewriteRule ^(.*)$ http://www.new-domain.com/$1 [R=301,L]
redirect 301 /old-index.html http://www.new-domain.com/
redirect 301 /old-page-1.html http://www.new-domain.com/new-1/
redirect 301 /old-page-2.html http://www.new-domain.com/new-2/
redirect 301 /old-page-3.html http://www.new-domain.com/new-3/发布于 2014-01-23 15:47:48
您应该坚持只使用mod_rewrite或mod_alias,而不是将两者混合使用。和秩序问题
mod_alias:
Redirect 301 /old-index.html http://www.new-domain.com/
Redirect 301 /old-page-1.html http://www.new-domain.com/new-1/
Redirect 301 /old-page-2.html http://www.new-domain.com/new-2/
Redirect 301 /old-page-3.html http://www.new-domain.com/new-3/
Redirect 301 / http://www.new-domain.com/mod_rewrite:
RewriteEngine on
RewriteRule ^old-index.html$ http://www.new-domain.com/ [R=301,L]
RewriteRule ^old-page-1.html$ http://www.new-domain.com/new-1/ [R=301,L]
RewriteRule ^old-page-2.html$ http://www.new-domain.com/new-2/ [R=301,L]
RewriteRule ^old-page-3.html$ http://www.new-domain.com/new-3/ [R=301,L]
RewriteRule ^(.*)$ http://www.new-domain.com/$1 [R=301,L]https://stackoverflow.com/questions/21312660
复制相似问题