<p>Migrating Redirects should not be thought of as a one-time event but a process that includes a step where you make sure Redirects are in place and working.</p>

<h2>A rough redirect strategy</h2>

<ol>
<li>Take a snapshot of where your old website stands. This can be a combination of using tools like Google Analytics, Screaming Frog, moz.com, raventools.com, or one of many other services that do similar things. The main goal of this step is to understand where your current website ranks and what errors your current website has. Whatever you do in this step, you're going to do it again after you launch and by understanding your baseline before you make significant changes you'll have a better picture of what may need correcting after you launch the new site.</li>
<li>Identify all the URLs that are changing and decide which ones you want to redirect. Often this is all of them. Sometimes, you might choose to clean things up or just focus on key pages. Redirects can be managed in various places. The easiest place to manage them may be via a plugin like <a href="https://sprout.barrelstrengthdesign.com/craft-plugins/seo/docs/getting-started/redirects" rel="noreferrer">Sprout SEO</a> or <a href="https://github.com/nystudio107/retour" rel="noreferrer">Retour</a> however managing them via the <code>.htaccess</code> file or some other lower level configuration is also an option.  A good way to consider which URLs need redirected is to look at your analytics data. You can filter Google Analytics data and get a list of all pages that have been visited in the past year ordered by page views to get a fairly accurate list of what's important that you should be caring about.</li>
<li>Get redirects in place. If you have a few redirects, adding them manually may be fairly straightforward. If you have lots, consider using regex patterns in your redirects. If a group of pages changes their URLs in the same way, you can likely write a single rule to match all of their URL patterns and forward those old pages to the new ones. I've given a more specific example of this below.</li>
<li>Once you go live, be sure to test your redirects (see notes below) and take another snapshot of your site and monitor the site for unexpected behavior. Google Search Console and various tools like the ones mentioned above can help you monitor the site for errors and make sure no big issues were accidentally introduced. Sprout SEO can help you capture all 404 Redirects and an admin can convert any pages that were missed into 301 Redirects. When you do find issues, be sure to address them as quickly as you can. The longer you let them sit, the more likely search engines will think they are the norm.</li>
</ol>

<h2>A few additional notes on redirects</h2>

<p>There are different types of redirects. If you set a redirect to be a 301 redirect, that rule will get cached in your user's browsers. If you happen to make a mistake and try to change your redirect, the only way a user that hit your last redirect will get rid of it is if they clear their browser cache. For this reason, I recommend starting out with 302 redirects and testing all redirects as 302s. If the redirects work as expected, you can then update them to 301 redirects to signal to search engines that your changes are permanent and reduce the change that you create a scenario where incorrect rules get accidentally cached in user's browsers.</p>

<p>If you have several redirects that follow the same pattern, you can use regexes to simplify the number of redirects you need. The following example is an .htaccess redirect that will match all incoming <code>article/{slug}</code> URLs and redirect them to a new blog section (the term used in regexes for matching patterns within parentheses is <code>Capturing Groups</code>).</p>

<pre><code>RewriteRule ^/article/(.*)$ /blog/$1 [R=301,L]
</code></pre>

<p>In your case, since the previous URL was very broad <code>{slug}</code> it may be challenging to find a pattern that matches your old URLs that doesn't also match all of your new URLS or new pages on your site. In this case, you may need to be more explicit in which URLs you are redirecting</p>

<p>If you do need to import 500 URLs, Sprout SEO Redirects can be converted from CSV and imported via Sprout Import.</p>

CC BY-SA 3.0
2018-04-03T03:09:44.760Z
2018-04-03T03:09:44.760Z
Ben Parizek
<p>Use a plugin like <a href="https://github.com/nystudio107/retour" rel="nofollow noreferrer">Retour</a> to do a 301 redirect.</p>

CC BY-SA 3.0
2018-04-01T15:50:03.077Z
Yes, I've used it before but I'm not sure if there's a way for me to not have to enter 500+ redirects manually.
brunouno
CC BY-SA 3.0
2018-04-03T03:36:07.557Z
RegEx is your friend!
andrew.welch
CC BY-SA 3.0
2018-03-31T21:31:39.940Z
2018-03-31T21:31:39.940Z
andrew.welch
<p>I migrated a site with over 500 posts from Wordpress to Craft 2.6 recently but came across this problem: the WP site used to set post's urls as <code>https://mysite.com/{slug}</code> while the new blog is (correctly) saving them to <code>https://mysite.com/blog/{slug}</code>. </p>

<p>The problem is, a lot of the post entries have great SEO positiong and I don't want to lose that, what is the best way to achieve this?</p>

<url><seo>
Change posts url without losing SEO positioning
# Change posts url without losing SEO positioning

(Asked by: username_0 on 2018-03-31)

I migrated a site with over 500 posts from Wordpress to Craft 2.6 recently but came across this problem: the WP site used to set post's urls as `https://mysite.com/{slug}` while the new blog is (correctly) saving them to `https://mysite.com/blog/{slug}`.

The problem is, a lot of the post entries have great SEO positiong and I don't want to lose that, what is the best way to achieve this?

**Tags:** url, seo


---

## 2 answers

### Answer by username_1 on 2018-04-03. Score: 5

Migrating Redirects should not be thought of as a one-time event but a process that includes a step where you make sure Redirects are in place and working.
A rough redirect strategy

Take a snapshot of where your old website stands. This can be a combination of using tools like Google Analytics, Screaming Frog, moz.com, raventools.com, or one of many other services that do similar things. The main goal of this step is to understand where your current website ranks and what errors your current website has. Whatever you do in this step, you're going to do it again after you launch and by understanding your baseline before you make significant changes you'll have a better picture of what may need correcting after you launch the new site.
Identify all the URLs that are changing and decide which ones you want to redirect. Often this is all of them. Sometimes, you might choose to clean things up or just focus on key pages. Redirects can be managed in various places. The easiest place to manage them may be via a plugin like Sprout SEO or Retour however managing them via the .htaccess file or some other lower level configuration is also an option.  A good way to consider which URLs need redirected is to look at your analytics data. You can filter Google Analytics data and get a list of all pages that have been visited in the past year ordered by page views to get a fairly accurate list of what's important that you should be caring about.
Get redirects in place. If you have a few redirects, adding them manually may be fairly straightforward. If you have lots, consider using regex patterns in your redirects. If a group of pages changes their URLs in the same way, you can likely write a single rule to match all of their URL patterns and forward those old pages to the new ones. I've given a more specific example of this below.
Once you go live, be sure to test your redirects (see notes below) and take another snapshot of your site and monitor the site for unexpected behavior. Google Search Console and various tools like the ones mentioned above can help you monitor the site for errors and make sure no big issues were accidentally introduced. Sprout SEO can help you capture all 404 Redirects and an admin can convert any pages that were missed into 301 Redirects. When you do find issues, be sure to address them as quickly as you can. The longer you let them sit, the more likely search engines will think they are the norm.

A few additional notes on redirects
There are different types of redirects. If you set a redirect to be a 301 redirect, that rule will get cached in your user's browsers. If you happen to make a mistake and try to change your redirect, the only way a user that hit your last redirect will get rid of it is if they clear their browser cache. For this reason, I recommend starting out with 302 redirects and testing all redirects as 302s. If the redirects work as expected, you can then update them to 301 redirects to signal to search engines that your changes are permanent and reduce the change that you create a scenario where incorrect rules get accidentally cached in user's browsers.
If you have several redirects that follow the same pattern, you can use regexes to simplify the number of redirects you need. The following example is an .htaccess redirect that will match all incoming article/{slug} URLs and redirect them to a new blog section (the term used in regexes for matching patterns within parentheses is Capturing Groups).
RewriteRule ^/article/(.*)$ /blog/$1 [R=301,L]

In your case, since the previous URL was very broad {slug} it may be challenging to find a pattern that matches your old URLs that doesn't also match all of your new URLS or new pages on your site. In this case, you may need to be more explicit in which URLs you are redirecting
If you do need to import 500 URLs, Sprout SEO Redirects can be converted from CSV and imported via Sprout Import.


---

### Answer by username_2 on 2018-03-31. Score: 3

Use a plugin like [Retour](https://github.com/nystudio107/retour) to do a 301 redirect.

> **Comments:**
> **username_0**: Yes, I've used it before but I'm not sure if there's a way for me to not have to enter 500+ redirects manually.  
> **username_2**: RegEx is your friend!  

---

