302 Redirect vs 301 Redirect – Best Practices (Explained)

Are you wondering what’s the different between 302 vs 301 redirects?

Redirects are important for providing a great user experience and helping search engines better understand your site. 302 and 301 are types of redirects you can use for different situations.

In this article, we will compare 302 redirect vs 301 redirect. We’ll also show the best practices when using redirects in WordPress.

301 vs 302 redirect

302 Redirect vs 301 Redirect – What’s the Difference?

Redirection in WordPress allows you to send users and search engine crawlers to a different URL than the one they clicked on.

You’d need to set up redirects if you delete a page on your WordPress site, move to a new domain, conduct A/B experiments, and more.

Without redirects, users would not be able to see the content they requested. Instead, they’ll see a 404 error page, which is bad for your site’s user experience and search engine rankings.

An example of a 404 page

When it comes to setting up redirects, you’ll come across two most common types: 301 and 302 redirects. Let’s look at each one of them and see what’s the difference.

What is a 301 Redirect?

A 301 redirect is a permanent redirect. If your website or web page has been moved permanently to a new location, then you can use 301 redirects to point users in the right direction.

For example, when a visitor types your site’s address or clicks on a link, the 301 redirect will automatically change the requested address to the new address.

What is a 302 Redirect?

A 302 redirect also helps point users and search engines in the right direction, but temporarily.

Unlike 301, which is a permanent redirect, 302 redirects are temporary. You can move your website traffic to a new location for a limited amount of time and then go back to the original URL whenever you want.

When Should You Use 301 and 302 Redirects?

Now that you know the main difference between the two types of redirections, you may be wondering when is the best time to use 301 and 302 redirects.

Under certain conditions and the goal you’re trying to achieve, it makes sense to use 301 redirects. While in other situations, it is better to use 302 redirects.

When to Use a 301 Redirect?

Since 301 redirects are permanent, here’s when to use them:

When to Use a 302 Redirect?

On the other hand, if you don’t want to point your audience to a new page or another location permanently, then it’s better to use 302 redirects. Here are some situations where using 302 redirection makes sense:

  • Conducting A/B tests for designs, layout, and features of a new website or page
  • Temporarily redirecting users to a sales page or promotional offer
  • Send users to the correct version of your website based on their language or location preference
  • Collect user feedback about a new product or service without impacting your current SEO rankings

Impact of 301 Redirects vs 302 Redirects on SEO

When it comes to using 301 or 302 redirects, you have to consider the impact it will have on your site’s WordPress SEO (search engine optimization).

Search engines work by crawling your website pages using bots and indexing them on the search results. These search engine bots follow links to discover new content and find different pages on your site.

Using the right type of redirection is important if you want to your blog posts to be easily uncovered by search engine crawlers and continue to rank higher on search results.

With 301 redirects, Google and other search engines will know that you’ve moved a site or web page permanently. This way, it will fully pass the link equity or link juice to the new URL. Link equity is like a vote of confidence from other sites that your page is valuable and worth promoting.

On the other hand, if you’re performing a temporary change and don’t want any impact on your original page’s SEO rankings, then it’s better to use 302 redirects. It doesn’t pass the link juice fully and tells search engines that the change is temporary.

How to Set Up 301 and 302 Redirects in WordPress

The easiest way of setting up 301 or 302 redirects on your site is by using a WordPress redirect plugin.

For instance, you can use All in One SEO (AIOSEO) for configuring redirects. It is the best SEO plugin for WordPress and offers a powerful redirection manager tool.

Do note that you’ll need the AIOSEO Pro version to use the redirection manager. There is also an AIOSEO Lite version you can use to get started for free.

First, you’ll need to install and activate the AIOSEO plugin. If you need help, then please see our guide on how to install a WordPress plugin.

Upon activation, you’ll see a welcome screen and the setup wizard. Simply click the ‘Let’s Get Started button’ and follow the onscreen instructions to configure the plugin.

AIOSEO Setup Wizard

You can also see our guide on how to set up All in One SEO for WordPress correctly.

Next, you’ll need to go to All in One SEO » Redirects from the WordPress admin area and click the ‘Activate Redirects’ button.

Activating the AIOSEO redirect feature

Once the Redirection Manager tool is active, you can go to the ‘Redirects’ tab at the top.

From here, you can enter the link that you’d like to redirect in the ‘Source URL’ field. Next, enter the new location for the link under the ‘Target URL’ field.

Enter Source URL and Target URL

After that, you can click the ‘Redirect Type’ dropdown menu and select 301 or 302 redirection.

Once that’s done, simply click the ‘Add Redirect’ button. You can repeat this step and add as many redirects as you want.

If you scroll down, then AIOSEO will show you a log of redirects you’ve created for your website.

View Redirect Logs in AIOSEO

Besides that, AIOSEO also lets you perform full site redirects without any technical knowledge or editing code.

Best Practices for Implementing 302 and 301 Redirects

Setting up redirection on your WordPress website can be complicated. To help you out, here are some best practices to follow.

1. Testing Redirects to Ensure They’re Working

After you’ve set up 301 or 302 redirects, it is better to test each link multiple times.

This is to ensure that the 301 and 302 redirection is working properly. If something goes wrong, then it will be bad for your site’s user experience and SEO rankings.

A simple way to check is by visiting your site in incognito mode and opening the link that you redirected. If it opens the new location, then it means your redirects are working fine.

There are also free tools available on the internet that will check redirection for you. Or you can use the AIOSEO plugin, which shows logs of your redirects inside your WordPress dashboard.

View Redirect Logs in AIOSEO

2. Monitoring Redirects for Broken Links

Next, you should also set up tracking for broken links after adding 301 and 302 redirects to your website.

If you moved a web page to another location or send users to a new page temporarily and the redirection didn’t work properly, then it will result in a broken link. As a result, users will see a 404 error page on your website.

Tracking these broken links after 301 and 302 redirection will help you fix them quickly, provide a better user experience, and avoid any impact on your keyword rankings.

The best way to track broken links is by using the AIOSEO plugin. You can enable the ‘404 Logs’ to start monitoring for 404 error pages.

Enable 404 logs

Do note that initially, you won’t see any data because it will only start recording broken links after you enable the setting.

Once the plugin starts gathering information, you can view broken links on your site under the 404 Logs tab.

Click 404 logs menu option

To quickly fix 404 error pages, you can click the ‘Add Redirect’ option and set up 301 or 302 redirections.

For more details, please see our guide on how to find and fix broken links in WordPress.

PRO TIP: If you want continuous updates on broken links that aren’t just 404 errors, check out our free Broken Link Checker plugin.

3. Avoid Creating Redirection Chains and Loops

A redirection chain is when you have multiple redirects between the source URL and the target URL. Google officially follows up to 10 hops in a redirection chain. If there are more than 10 redirects, then it could show a redirect error in the Google Search Console.

That’s why it is a best practice to avoid redirection chains and point directly to the new location of a website or page. This is especially important when setting up permanent 301 redirects. Having too many 301 redirects can cause errors and lead to poor user experience.

Besides that, you should also try to avoid redirection loops. It occurs when the URLs in a chain redirect back to itself and creates an infinite loop.

As a result, users and search engines won’t see the intended page and instead view the original page. This could also result in a ‘redirected you too many times’ error.

Too many redirects error

One way of fixing it is to remove all redirects in the chain and try redirecting to the final destination.

To learn more, you can see our guide on how to fix too many redirect issues in WordPress.

4. Create Redirects to Avoid Duplicate Content

Another best practice for using 301 and 302 redirects is to avoid duplicate content if your site has multiple subdomains.

For example, if your site’s URL has HTTP and HTTPS, www and non-www, capitalized and lower-case URLs, trailing slashes (/), and more.

Although these subdomains point to the same web address, search engines will view them as separate sites. As a result, it could lead to duplicate content issues. To fix this, you can simply redirect all subdomains to a single website URL.

If you are migrating sites and domains, also, you might use a 302 redirect to show Google and other search engines that you’re moving, and the content won’t be duplicated forever.

You will then have to create 301 redirects to tell search engines which is the preferred version of the content you want them to index.

Additional Resources

Here are some more guides and reading material you can go through:

We hope this article helped you learn the difference between 302 redirects vs 301 redirects and best practices. You may also want to see our guide on what’s the difference between domain name and web hosting and the best live chat software for small businesses.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post 302 Redirect vs 301 Redirect – Best Practices (Explained) first appeared on WPBeginner.

How to Fix WordPress Redirecting to Old Domain After Migration

Do you want to fix the issue of redirecting to an old domain?

When you migrate a WordPress website to a new domain, there is a possibility that users will be redirected back to the old domain.

In this article, we will show you how to fix WordPress redirecting to an old domain after migration.

How to fix WordPress redirecting to old domain after migration

What Causes Redirection to Old Domain After Migration Issue?

When you’re moving your WordPress website to a new domain, it is important to set up redirection. This way, users automatically land on the new location, and you get to keep your keyword rankings and traffic.

However, redirection to a new domain may not work properly, and your visitors would be redirected back to the old domain.

One of the main causes for this issue is that your site URL and home URL values are different in the WordPress database tables. You need to make sure that both these values lead to your new domain.

Besides that, DNS issues can also cause users to redirect to the old domain after migration. If the DNS server is not responding or DNS records haven’t been updated, then your visitors won’t be able to view your new website URL.

That said, let’s see how you can fix WordPress redirecting to the old domain after migration. We will cover different methods, so you can click the links below to jump ahead to your preferred section.

Method 1: Update the Site Address in WordPress Settings

The easiest way to fix this issue is by ensuring that the WordPress address and site address is the same in your WordPress settings.

If your Site Address (URL) still shows the old domain, then users will be redirected to the previous URL after migration.

To fix this, simply head to Settings » General from your WordPress admin panel. After that, enter your new domain under the ‘Site Address (URL)’ field.

Site address URL

Once you’re done, simply save your changes and visit the new domain to see if the problem is resolved.

If, however, the URL fields are greyed out and won’t let you type a new address, continue reading and use one of the other methods to redirect your domain.

Method 2: Changing Site URL in WordPress Database

Another method of fixing the redirecting to the old domain issue is by updating the site URL in the WordPress database tables.

You can easily access the database using the cPanel provided by the WordPress hosting service. For this tutorial, we will be using Bluehost as an example, but the process is similar for other hosting companies like Hostinger, SiteGround, etc.

First, you’ll need to log in to the hosting service control panel. After that, simply click on the ‘Advanced’ tab from the menu on your left.

Bluehost's PhpMyAdmin tool

Next, you can scroll down to the Databases section and click the ‘phpMyAdmin’ option.

You will need to wait for a few seconds until phpMyAdmin opens.

Once it opens, you will need to go to the wp_options table from the navigational panel on your left.

Do note that each hosting service has a different naming convention for database tables. However, the one you’re looking for will always end in ‘_options.”

For example, in this tutorial, we will click the ‘staging_45f_options’ table in Bluehost’s phpMyAdmin.

Open the options table

Next, you will need to edit the ‘siteurl’ and ‘home’ options.

First, go ahead and click the ‘Edit’ button for ‘siteurl’ option.

Enter siteurl

After that, you will need to enter the new domain name in the option_value field. Once that’s done, simply click the ‘Go’ button.

Now, you can return to the main wp_options page and edit the ‘home’ option.

Enter the home field value

Next, you will need to enter the new domain in the option_value field.

After entering the value, click the ‘Go’ button.

Method 3: Flush DNS Cache on Your PC

If you’re still unable to resolve the issue of the old domain redirecting after migration, then you should check the DNS settings.

At times, it can take up to 12 to 48 hours for the change of domain name to take effect. As a result, internet providers that don’t have updated DNS records will redirect users to the old domain.

You simply flush the DNS cache so that it gets the latest information and the new website URL. This also helps resolve the DNS server not responding issue.

For more details, please see our guide on how to clear your DNS cache on Mac, Windows, and Google Chrome.

Pro Tip: Use SEO Plugin to Perform Full Site Redirect

When you manually perform redirection to a new domain, then there is always a chance of errors. As a result, users would still be redirected to the old domain.

An easier way of setting up redirection is by using an WordPress SEO plugin like All in One SEO (AIOSEO). It offers a powerful redirection manager that you can use to redirect your entire site to a new domain without any issues.

Full site redirect in All in One SEO

This tool was built by our team, and it is what we use when we’re migrating websites to a new domain or merging two sites into one. You can learn more by following our step by step guide on how to properly do a full site redirect in WordPress.

We hope that this article helped you learn how to fix WordPress redirecting to an old domain after migration. You may also want to see our guide on the most common WordPress errors and how to fix them and our expert picks for the must-have WordPress plugins for business sites.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Fix WordPress Redirecting to Old Domain After Migration first appeared on WPBeginner.

How to Move a Site from WordPress Multisite to Single Install

Do you want to move a site from a WordPress multisite to a single install?

If you run a WordPress multisite network, sometimes, you may need to move one of the websites to its own separate WordPress install.

In this article, we’ll show you how to easily move a site from WordPress multisite to its own single install while preserving SEO rankings and all your content.

Moving a child site from WordPress multisite

Step 1: Getting Started

To move a website from a WordPress multisite network, you’ll need a domain name.

If you already have a domain name where you want to install the single site, then you are good to go.

If you don’t have a separate domain name, you’ll need to register and add a new domain name to your hosting account.

We recommend using Domain.com. They are one of the best domain name registrars in the world and offer beginner-friendly domain management experience.

For more details, see our article on how to register a domain name.

Alternatively, you can buy a separate hosting account and domain name for your fresh WordPress install.

We recommend using Bluehost. They are offering a free domain name with a generous discount on hosting.

Basically, you can get started for $2.75 per month.

After getting your domain name and hosting, the next step is to install WordPress.

See our step-by-step WordPress installation tutorial if you need help.

Important: Since you are going to make some serious changes to your WordPress multisite, it is necessary to create a complete WordPress backup before you do anything else.

Now that everything is set up, let’s move a site from WordPress multisite network to its single install.

Step 2: Exporting a Single Site in WordPress Multisite Network

The built-in WordPress import/export functionality works the same way in multisite as it does on a single site install. We will use the default tools to export the data from a site on a WordPress multisite network.

First, you need to log in to the dashboard of the single site you want to move, and then click on Tools » Export.

Next, you want to ensure all content is checked and click on the Download Export File button.

Export single site in a WordPress multisite

WordPress will now create an XML file containing all your data and send it to your browser for download.

Be sure to save the file on your computer because you will need it later.

Step 3: Importing Child Site to New Domain

Login to the WordPress admin area on the new location where you want to move your child site and then go to Tools » Import. On the import screen, WordPress will show you a number of import options.

Install WordPress importer on the new single site

You need to click on the ‘Install Now’ link below ‘WordPress.’

Wait for the importer to be installed and then click on the ‘Run Importer’ link.

Run WordPress importer

On the next screen, you will be asked to upload the WordPress export file you downloaded earlier from the WordPress multisite.

Click on the Choose file button to select the file from your computer and then click on the ‘Upload file and import’ button.

Upload import file

On the next screen, WordPress will ask if you would also like to import users. If you do nothing, then WordPress will import all users. This is recommended if you do not want to change authors.

You will also see the Import Attachments option, and you want to make sure it is checked so that WordPress can download images from your posts and pages.

Don’t worry if it misses out on some or most of your images. You can import them separately afterward.

Import settings

Click on the ‘Submit’ button to continue.

WordPress will now start importing your content. This will take a few minutes depending on how much content you have. Once it is done, you will see a notification that says ‘All done. Have fun!’

Importing finished

That’s all. You have successfully imported data from a multisite network child site to an individual WordPress install. There are still a few things left to do.

Step 4: Setting up Redirection

If you were using WordPress multisite with custom domains, then you don’t have to set up any redirection.

However, if you were using subdomains or directory structures in your WordPress multisite, you need to set up redirection so that users coming to your old URLs are redirected to your new site.

There are two ways to do this. You can set up a redirect using a WordPress plugin (recommended), or you can add some code to your WordPress .htaccess file.

We’ll show you both methods, and you can choose the one that best suits you.

Note: Make sure that your old site on the multisite network and the site on the new domain are both using the same permalink structure.

Method 1. Setting Redirects Using All in One SEO for WordPress

This method is easier and recommended for all users. We’ll be using All in One SEO for WordPress, which is the best WordPress SEO plugin on the market.

It allows you to easily optimize your WordPress site for search engines and comes with powerful features like SEO analysis, custom XML sitemaps, Schema.org support, and a redirects manager.

First, install and activate the All in One SEO for WordPress plugin on your WordPress multisite and then Network Activate it for the child site. For more details, see our guide on network activating plugins on WordPress Multisite.

Network activate a plugin

Note: You’ll need at least the Pro plan to access the Redirection Manager feature.

Next, you need to install and network activate the Redirection Manager addon. You can find it under ‘Downloads’ from your account page on the All in One SEO website.

Download redirection addon for All in One SEO

Once you have network-activated both plugins, you need to switch to the dashboard of the child site.

From here, go to the All in One SEO » Redirects page and switch to the ‘Full Site Redirect’ tab.

Redirect settings

First, turn on the Relocate Site option by toggling the switch next to it.

Then, enter your new site’s domain name next to ‘Relocate to domain’ option.

Now click on the Save Changes button to store your settings.

All in One SEO for WordPress will now redirect users to your new domain name.

Method 2. Setting up Redirects using the Redirection Plugin

First, you need to install the Redirection plugin on your WordPress Multisite.

You can Network Activate a plugin, or you can log in as Super Admin on your child site and activate the Redirection plugin for that particular site alone.

After that, you need to visit the admin dashboard of the child site for which you want to set up the redirect.

Redirecting from Subdomain to New Domain

The Redirection plugin makes it super easy to point a domain name to a different one.

Simply go to the Tools » Redirection page and switch to the ‘Site’ tab.

Redirection set up

Simply enter your new domain name and then click on the ‘Update’ button to save your settings.

The plugin will redirect all your site users to your new domain name with the correct permalink structure.

The advantage of this method is that you can still log in to the admin area of your old subdomain.

Redirecting from Directory to New Domain

If your multisite uses a directory-based URL structure, then the Redirection plugin makes it easy to redirect it properly to your new domain.

Simply go to the Tools » Redirection page on your sub-site, and then click on the Add New button at the top.

New redirect

This will take you to Redirection’s setup form. Here is how you need to fill in that form:

Source URL: ^childsite/(.*)$
Target URL: https://example.com/$1

Be sure to replace childsite and example.com with the name of your subsite and its new location.

Don’t forget to change select ‘Regex’ from the dropdown to the right, and then just click on the Add Redirect button to save your settings.

Redirect subdirectory

You can now visit your sub-site to see the redirects in action.

Method 2. Setting up Redirects Using .htaccess file

For this method, you need to add redirect rules to the .htaccess file in your WordPress hosting account for your multisite network.

Subdomain to New Domain Redirect

For subdomain installs, you need to use this code in the .htaccess file of your WordPress multisite.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.net/$1 [L,R=301]

This code redirects visitors coming to any page on subdomain.example.com to http://www.example.net. The $1 sign at the end of the destination URL ensures that your users land on the same page they requested.

Redirecting From Directory to New Domain

For directory-based multisite installs, you’ll need to paste the following code in the .htaccess file of your WordPress multisite.

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^childsite/(.*)$ http://example.net/$1 [R=301,L]

This code simply redirects any users coming on http://www.example.com/childsite/ to http://example.net. The $1 makes sure that your users land on exactly the same page or post they requested.

Don’t forget to replace childsite and example.net with the name of your subsite and its new location.

Step 5: Troubleshooting the Migration

Moving a site is not a routine task, so it is likely that you may come across some issues.

1. Export File Too Large – If your WordPress export file is too large, you may fail to import it properly. To fix this, you may need to split large XML file into smaller pieces.

2. Images Not Imported – Another common issue is that images may not import correctly to your new site. To fix this, you can try importing them as external images.

3. Redirects Not Working – If users are not being redirected correctly to your new site, then you need to carefully review your redirect settings. Make sure that your single install and the child site are both using the same Permalinks structure.

For other issues, see other common WordPress errors and how to fix them.

We hope this article helped you move a site from a WordPress multisite to a single install. You may also want to review our WordPress SEO checklist for your new install or try these essential WordPress plugins on your fresh site.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

The post How to Move a Site from WordPress Multisite to Single Install first appeared on WPBeginner.