Reputation: 725
My application was built with WordPress. After 4 years I migrated from WordPress to Ruby on Rails 4.2.4
.
My google page score is very good and I would like to redirect my WordPress links to my new setup (Ruby on Rails). My Ruby on rails applications link structure is different then WordPress.
PS: I still on same domain
WP Link Structure:
my-website.com/year/month/day/Post-Title
Ruby on Rails Link Structure:
my-website.com/p/Post-Title
How can I permanently move old links to my new links and have SEO in mind.
I am basically doing this for SEO
Upvotes: 0
Views: 205
Reputation: 74078
To redirect from old links structure to another, while keeping only a part of the original URLs, you must capture this part and use it in the target URL
RewriteEngine on
RewriteRule ^.+?/.+?/.+?/(.+)$ /p/$1 [R,L]
The first three .+?
match year, month and day. The final (.+)
captures the title, so it can be reused in the target URL /p/$1
.
When everything works as it should, you may replace R
with R=301
(permanent redirect). Never test with R=301
.
Upvotes: 1