简体   繁体   中英

How do I create 301 redirect from WordPress (hosted on wsynth) to a Rails app hosted on Heroku?

I have a website (example.com) that is a WordPress site hosted on WSYNTH. I am redesigning the site, same domain (example.com) in ROR hosted on Heroku.

I have been told that for SEO purposes, once I point my domain to the ROR app on Heroku, all the old pages from the Wordpress site will go dark. (Makes sense.) But this would be very bad for SEO, since example.com will now have many URLs associated with it (created from the WP site) that are no longer valid.

I've heard that a 301 Redirect for those WordPress URLs will take care of this SEO issue. But how and where should I do this? Should I be installing a plugin in WordPress that will automate the redirects to the pages I want to send them to in the ROR/Heroku app?)

Also, is it possible to keep some of those old WordPress URLs live?

DNS

The 301 redirect is not the issue - you can use Wordpress itself to redirect to specific pages (using the simple 301 redirects plugin), or a better way will be to redirect your domain (with your DNS) to your Rails app, and then use the routes to handle any stray pages

The world of "SEO" is highly overrated - Google is just a system which follows links. If it cannot find a page, it removes it from its rankings; if it can find the page, it judges its on & off-site optimization to determine its relevance.

This means the only thing you need to concern yourself with is ensuring you don't have any "holes" in your URLs. The redirections essentially mean you will tell Google to follow a link to the new page

--

Redirections

The first thing you need to do is ensure you have the new pages you wish to show on your site. Preferrably, you'll want to make as many of them as identical to your previous URLS as you can.

Secondly, you can introduce redirects in your Rails routing system to give Google real pages when it visits the links for your Wordpress site:

#config/routes.rb
get '/your-old-post-name', to: redirect('/your-new-post-name')

This will mean you will have to create redirections for every wordpress post in your new Rails app - but should give Google the knowledge that those pages have changed, to which it will update

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM