redirect - 将当前网站切换到新的 Rails 应用程序 - SEO 重定向最佳实践

标签 redirect heroku ruby-on-rails-4 seo

我刚刚为我的企业创建了一个新的 Rails Web 应用程序,但为了谷歌搜索引擎优化目的,我想保留旧域名。如何将旧链接重定向到同一域中的新链接?

例如,我有这个旧页面...
http://www.horschgallery.com/photo/black-white-chicago-vertical/chicago-cityscape-photo-sears-tower-willis-tower.aspx

需要重定向到当前托管在 heroku 上的新页面 http://horschgallery.herokuapp.com/photos/chicago-cityscape-photo-sears-tower-willis-tower

但我想将 heroku 应用程序放在 horschgallery.com 域上(该域尚不存在,因为我需要更改我的服务器指向的 IP 地址) horschgallery.com/photos/chicago-cityscape-photo-sears-tower-willis-tower

最佳答案

将此代码粘贴到您的旧域中并输入域 url

<script language=javascript>
function redirect(){
  window.location = "http://example.com";
}
</script>

<body onload="redirect()">

</body>

或单击此处 --> Changing Your URL Without Penalizing Your Search Engine Optimization

关于redirect - 将当前网站切换到新的 Rails 应用程序 - SEO 重定向最佳实践,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23352950/

相关文章:

java - Struts 2 我无法通过

apache - 如何通过 .htaccess 正确地将 index.php 重定向到另一个页面?

ruby-on-rails - Heroku:预编译 Assets 失败

ruby-on-rails-4 - 在 Multi-Tenancy Rails 4 中使用 Appartment gem 时如何获取当前租户

ruby-on-rails - Rails date_select 助手不显示两位数的月份数字

ruby-on-rails - form_for - Ruby on Rails

.htaccess mod_rewrite 变量通过重定向

http - 如何避免浏览器重定向缓存

mongodb - Heroku + Node.js + MongoHQ + Expressjs

Javascript 代码有时只运行