我目前在www.mydomain.com上有一个wordpress站点,有3500多篇文章(= V1)。
我开发了一个100% Rails的新版本(=V2)
我想:
发布于 2015-10-08 14:22:49
我不是Ruby专家,但您可以尝试这样的方法:
#If page not found
def not_found
# Check if page that user want to access is available at your old website
require "net/http"
url = URI.parse("http://archives.mydomain.com/some-article")
req = Net::HTTP.new(url.host, url.port)
res = req.request_head(url.path)
# If it's available, redirect user to old website
if(res.code == "200")
redirect_to "http://archives.mydomain.com/some-article", :status => :moved_permanently
else
raise ActionController::RoutingError.new('Not Found')
endhttps://stackoverflow.com/questions/33018032
复制相似问题