Maker's Aid Logo

Maker's Aid

Browser Behavior and 301 Redirects

Wondering whether browsers cache 301 redirects or not, and for how long? Read on, because we have it all for you!

safari 301 redirect

According to RFC 9110 , the memo that sets the standard for the Hypertext Transfer Protocol (HTTP), a 301 redirect is heuristically cacheable unless defined otherwise in the HTTP method’s definition or caching directives in the Expires or Cache-Control HTTP header.

In other words, it’s normal behavior for browsers to cache responses to requests with a status code of 301. In fact, to make the World Wide Web economic for webmasters and performant for users, it’s expected of them to do so!

As web performance architect Paul Calvano explains in his blog , if you don’t set the Expires or Cache-Control headers in your web server’s responses, a browser can cache the resources on it “forever.”

Now, I put “forever” in quotes because, at some point in the service life of their device, the user could clear the cache, reset their phone or tablet to factory settings, or reinstall the OS on their computer—which would forcibly clear the cached redirection.

(There’s also the edge case that, eventually, the browser automatically deletes the cached 301 redirect to make room for other caches from the user’s more recent browsing activity.)

This, as you can probably guess by now, has important implications for anyone who relies on 301 redirects to develop or operate their website or web application.

For starters, if you don’t want a 301 redirect to be locally cached in users’ browsers forever, you should set appropriate Expires or Cache-Control headers in your web server’s HTTP responses.

Setting 301 redirects aside for a moment, this also means that you should consider appending the URLs of resources that are likely to change—CSS files, JS scripts, others—with version parameters to signal to browsers when a new version is live even if the cache for the old version is still considered fresh.

How Different Browsers Handle 301 Redirects

Of course, this is all good to know, but it’s not very helpful if you’re developing a website or web application and you’re trying to deal with a cached 301 redirect. So let’s talk about how different browsers handle 301 redirects—and what you can do about it.

Does Google Chrome Cache 301 Redirects?

Yes, Google Chrome caches 301 redirects locally. Unless caching directives in the Expires or Cache-Control HTTP headers explicitly state otherwise, Chrome keeps the cached response indefinitely.

To clear the cache for a 301 redirect in Google Chrome, you must manually clear the browsing cache or hard-reload the URL in question. Alternatively, you can open the Developer sidebar, navigate to the Network tab, toggle Disable Cache on, and refresh the URL.

Does Microsoft Edge Cache 301 Redirects?

Yes, Microsoft Edge caches 301 redirects locally. Unless caching directives in the Expires or Cache-Control HTTP headers explicitly state otherwise, Edge keeps the cached response indefinitely.

To clear the cache for a 301 redirect in Microsoft Edge, you must manually clear the browsing cache or hard-reload the URL in question. Alternatively, you can open the Developer sidebar, navigate to the Network tab, toggle Disable Cache on, and refresh the URL.

Does Mozilla Firefox Cache 301 Redirects?

Yes, Mozilla Firefox caches 301 redirects locally. Unless caching directives in the Expires or Cache-Control HTTP headers explicitly state otherwise, Firefox keeps the cached response indefinitely.

To clear the cache for a 301 redirect in Firefox, you must manually clear the browsing cache or hard-reload the URL in question. Alternatively, you can open the Developer Tools sidebar, navigate to the Network tab, toggle Disable HTTP Cache on, and refresh the URL.

Does Safari Cache 301 Redirects?

Yes, Apple’s Safari browser caches 301 redirects locally. Unless caching directives in the Expires or Cache-Control HTTP headers explicitly state otherwise, Safari keeps the cached response indefinitely.

To clear the cache for a 301 redirect in Safari, you must open the Developer sidebar, navigate to the Network tab, toggle Disable Cache on, then refresh the URL.

In Conclusion

Yes, browsers cache 301 redirects indefinitely unless there are cache directives in the HTTP response headers that specifically say otherwise. The only ways to clear these caches is to clear the browser cache, perform a hard reload, or disable caching altogether.

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.

Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.



We come across a lot of different errors here at Kinsta, and ERR_TOO_MANY_REDIRECTS (also known as a redirect loop) is one we see on a regular basis.

Typically this occurs after a recent change on your website, a misconfiguration of redirects on your server, or wrong settings with third-party services. But don’t worry, this error is fairly easy to fix.

Check out the recommendations below on how to fix this error and get your site back up and running.


The ERR_TOO_MANY_REDIRECTS error is pretty much what it sounds like: something is causing too many redirects , sending your website into an infinite redirection loop.

Essentially the site is stuck (such as URL 1 points to URL 2 and URL 2 points back to URL 1, or the domain has redirected you too many times) and unlike some other errors, these rarely resolve themselves and will probably need you to take action to fix it.

You might have also come across the error “ request exceeded the limit of 10 internal redirects due to probable configuration error “.


The ERR_TOO_MANY_REDIRECTS error occurs as a result of a misconfiguration of redirects on your server, or incorrect settings with third-party services. This error is essentially what it implies: a loop of too many redirects is causing your website to be stuck in an endless cycle.


There are a couple of different variations of this error depending upon the browser you’re running.

Google Chrome

In Google Chrome this error will show as  ERR_TOO_MANY_REDIRECTS (as seen below) or This webpage has a redirect loop problem .

This page isn’t working. redirected you too many times.


(Check out how to fix Chrome’s ERR_CACHE_MISS error).

Mozilla Firefox

In Mozilla Firefox it will show as  The page isn’t redirecting properly (as seen below).

An error occured during a connection to This problem can sometimes be caused by disabling or refusing to accept cookies.


Microsoft Edge

In Microsoft Edge, it will simply show as  This page isn’t working right now (as seen below). redirected you too many times.


In Safari, it will show as Safari Can’t Open the Page (as seen below).

Too many redirects occurred trying to open “” This might occur if you open a page that is redirected to open another page which is then redirected to open the original page.


What Causes the ERR_TOO_MANY_REDIRECTS Error?

This error happens when the browser can’t establish a connection between the initial page and the destination page in a redirect. The main causes can be:

  • Misconfigured WordPress settings
  • Misconfigured WordPress plugin.
  • Misconfigured server settings.
  • Incorrect HTTPS settings.
  • Issues with the browser’s cache/cookies.
  • Issues with third-party services (e.g. CDNs).
  • Improper website or domain migration.


Here are some recommendations and things to check to fix the error (sorted in order by most common reasons we see):

  • Delete Cookies on That Specific Site
  • Clear Server, Proxy, and Browser Cache
  • Determine Nature of the Redirect Loop
  • Check Your HTTPS Settings
  • Check Third-Party Services
  • Check Your WordPress Site Settings
  • Temporarily Disable WordPress Plugins
  • Check Redirects on Your Server

1. Delete Cookies on That Specific Site

Google and Mozilla both in fact recommend right below the error to “try clearing your cookies.” Cookies can sometimes contain faulty data in which could cause the ERR_TOO_MANY_REDIRECTS error. This is one recommendation you can try even if you’re encountering the error on a site you don’t own.

Due to the fact that cookies retain your “logged in” status on sites and other settings, we recommend simply deleting the cookie(s)  on the site that is having the problem . This way you won’t impact any of your other sessions or websites that you frequently visit.

Follow the steps below to delete a cookie on a specific website in Google Chrome.

In Google Chrome click on the three small dots in the upper right-hand corner. Then click on “Settings.”

Chrome settings

Scroll down and click on “Advanced.”

Chrome advanced settings

Then click on “Content settings.”

Chrome content settings

Click on “Cookies.”

Chrome cookies

Then click on “See all cookies and site data.”

Chrome see all cookies

Search for the site (domain) where you are encountering the ERR_TOO_MANY_REDIRECTS error. You can then delete the cookie(s) currently stored on your computer for that domain. Then try visiting the site again.

Delete cookie in Chrome

2. Clear Server, Proxy, and Browser Cache

Due to the fact that redirect loops are responses that can be cached, it’s always recommended to try clearing the cache on your WordPress site, the server, third-party proxy services, and even your browser if necessary.

Clear WordPress Site Cache

Depending upon the type of redirect loop, you might still be able to gain access to your WordPress admin dashboard. In this case, you can easily clear the cache within the settings of your caching plugin. Here are a couple of quick links on how to clear WordPress cache with popular plugins:

  • Clear Cache with Cache Enabler
  • Clear Cache with W3 Total Cache
  • Clear Cache with Super Cache

If you’re a Kinsta client, you can easily clear your cache from the WordPress admin toolbar.

Clear Kinsta cache from WordPress admin

Clear Server Cache

If you can’t access WordPress admin , many WordPress hosts have their own control panel tools for clearing the cache on your WordPress site.

If you’re a Kinsta client, you can manually clear WordPress cache from within the MyKinsta dashboard. Here are the steps:

Within the dashboard, click on WordPress Sites in the left sidebar navigation.

Click on your site name in the sites list and click on the Tools tab.

Click the Clear cache button to clear all cache.

Clear cache on the Tools tab in MyKinsta.

Clear Proxy Cache

If you’re using a third-party reverse-proxy service such as Cloudflare or Sucuri, it can also be beneficial to clear the cache on their side.

To purge Cloudflare cache, login to their dashboard, click into “Caching” and click on “Purge Everything.”

Purge cache

To purge Sucuri cache, login to their dashboard, go to “Performance” and click on “Clear Cache.”

Clear Sucuri cache

Clear Browser Cache

If you want to check and see if it might be your browser cache, without clearing your cache, you can always open up your browser in incognito mode . Or test another browser and see if you still see the ERR_TOO_MANY_REDIRECTS error.

Open Chrome in Incognito mode

If you determine it is being caused by your browser cache, you can then clear it. Below are instructions on how to do it in various browsers:

  • How to Force Refresh a Single Page for All Browsers
  • How to Clear Browser Cache for Google Chrome
  • How to Clear Browser Cache for Mozilla Firefox
  • How to Clear Browser Cache for Safari
  • How to Clear Browser Cache for Internet Explorer
  • How to Clear Browser Cache for Microsoft Edge
  • How to Clear Browser Cache for Opera

3. Determine Nature of Redirect Loop

If clearing the cache didn’t work, then you’ll want to see if you can determine the nature of the redirect loop. Our free online Redirect Checker tool can help provide some further analysis into what might be going on. This could also be done via cURL.

For example, on the site below, it has a 301 redirect loop back to itself, which is causing a large chain of faulty redirects. You can follow all the redirects and determine whether or not it’s looping back to itself, or perhaps is an HTTP to HTTPS loop in which we’ll discuss how to solve that further below.

Too many redirects

The Redirect Path Chrome extension can also be very useful and provides insights into all of the redirects happening on your site (specific URL or page.

Redirect Path extension

4. Check Your HTTPS Settings

Another thing to check is your HTTPS settings. A lot of times we’ve seen ERR_TOO_MANY_REDIRECTS occur when someone has just migrated their WordPress site to HTTPS and either didn’t finish or set up something incorrectly.

Don’t Force HTTPS Without an SSL Certificate

This is by far the most common reason we see on a regular basis. If you force your WordPress site to load over HTTPS without first installing an SSL certificate, you’ll instantly throw your site into a redirection loop. To fix this, simply install an SSL certificate on your WordPress site.

It’s also recommended to run an SSL check . SSL/TLS certificates require not only your main certificate but also what they call intermediate certificates (chain) to also be installed. These need to be set up properly.

We recommend using the free SSL check tool from Qualys SSL Labs. It is very reliable and we use it for all Kinsta clients when verifying certificates. Simply head over to their  SSL check tool , input your domain into the Hostname field and click on “Submit.” You can also select the option to hide public results if you prefer. It could take a minute or two to scan your site’s SSL/TLS configuration on your web server.

SSL check

Don’t Use an SSL Plugin, Update your Hard-coded Links

There are some free SSL WordPress plugins, such as the  Really Simple SSL  plugin that will help you automatically redirect to HTTPS. However, we don’t recommend this method as a permanent solution because third-party plugins can always introduce another layer of problems and compatibility issues. It’s a good temporary solution, but you should really update your hard-coded HTTP links .

We have a great tutorial with 4 easy ways to do a search and replace in WordPress . If you’re a Kinsta client, you can always reach out to our support team to do this for you as well.

Check HTTP to HTTPS Redirects on Server

It could very well be that perhaps the HTTPS redirect rules on your server were misconfigured.

Redirect HTTP to HTTPS in Nginx

If your web server is running Nginx , you can easily redirect all of your HTTP traffic to HTTPS by adding the following code to your Nginx config file. This is the recommended method for redirecting WordPress running on Nginx.

We use Nginx for everyone here at Kinsta. The great news is that you don’t have to worry about this. If you need to add a redirect simply open up a quick  support ticket and let us know which domain you need to be redirected. We then add it to the Nginx config for you.

Check Out Our Video Guide to Redirects :

Redirect HTTP to HTTPS in Apache

If your web server is running Apache , you can easily redirect all of your HTTP traffic to HTTPS by adding the following code to your  .htaccess  file . This is the recommended method for redirecting WordPress running on Apache.

Check For Too Many HTTPS Redirects

Perhaps you simply have too many HTTPS redirects. You can easily check your site to see how many redirects it’s using with a tool like Redirect Checker . Here is an example below of redirects that are not set up correctly which are easily spottable using an online tool. You can see that there are duplicate HTTPS redirects happening on both the www and non-www versions.

redirects not setup correctly

5. Check Third-Party Services

ERR_TOO_MANY_REDIRECTS is also often commonly caused by reverse-proxy services such as Cloudflare . This usually happens when their Flexible SSL option is enabled and you already have an SSL certificate installed with your WordPress host. Why? Because, when flexible is selected, all requests to your hosting server are sent over HTTP. Your host server most likely already has a redirect in place from HTTP to HTTPS, and therefore a redirect loop occurs.

To fix this you need to change the Cloudflare Crypto settings from Flexible to either Full or Full (strict). If you’re a Kinsta client, make sure to also check out our steps on how to install an SSL certificate while using Cloudflare .

Cloudflare full

You can use their Always Use HTTPS page rule to redirect all users to HTTPS without creating a loop. Another thing to watch out for with Cloudflare is their forwarding URL redirection rules . Be careful not to create a redirect where the domain points to itself as a destination. This can cause an infinite redirect error, and the affected URLs will not be able to resolve.

If you’re using StackPath, they have an option called “Origin Pull Protocol” that needs to be set to HTTPS only.

Using Cloudflare DNS Only

If you only want to use Cloudflare’s DNS, and not their proxy/WAF service, then you should make sure your DNS records are set to “DNS Only.” The clouds will appear as “grey” instead of “orange.” You configure this under the “DNS” tab in the Cloudflare control panel.

Cloudflare DNS only

6. Check Your WordPress Site Settings

Another thing to check is your WordPress site settings. There are two different fields you’ll want to ensure are set correctly, and not pointing at a wrong domain or are mismatched. Another common mistake is that you’re not using the correct prefix to match the rest of your site, www or non-www. Sometimes people migrate hosts, or change domains and these can get changed without you realizing it.

  • WordPress Address (URL): The address to reach your blog.
  • Site Address (URL): The address of your WordPress core files.

Both should match unless you are  giving WordPress its own directory .

WordPress address

Most likely though you aren’t able to access your WordPress dashboard. So what you can do is override the settings above by inputting the values in your wp-config.php file .

The wp-config.php file is typically located at the root of your WordPress site and can be  accessed via FTP , SSH, or WP-CLI. To hard-code WP_HOME and WP_SITEURL, simply input the following code towards the top of the file, changing the values to reflect your domain.

Below is an example of what your wp-config.php file might look like afterward.

change wordpress url wp-config.php

Or if you prefer, here are two additional ways you could change your WordPress URLs without access to your admin dashboard:

  • Change WordPress URL Directly in Database
  • Change WordPress URL With WP-CLI

Once you manually set it, you can browse to your site to verify whether or not it fixes the redirect loop.

If you’re changing domains on a multisite , make sure to also check the wp_blogs table. We’ve seen people do a search and replace wrong and cause an infinite redirect loop. This is because the network site doesn’t match the subsites.

wp_#_options : Each subsite will have sets of tables that correspond to the  blog_id  in the  wp_blogs  table. Go to the  wp_#_options  table, where # corresponds to the  blog_id , and update the “SITEURL” and “HOME” settings in that table.

7. Temporarily Disable WordPress Plugins

When it comes to WordPress, temporarily disabling all your WordPress plugins can be a quick way to spot problems. For example, plugins such as Redirection or Yoast SEO premium let you implement redirects . Sometimes settings or updates to these plugins can conflict with redirects that might already be set on your server, causing a redirect loop.

Remember, you won’t lose any data if you simply disable a plugin. Most likely you can’t access the WordPress admin, so you’ll need login via SFTP to your server and rename your plugins folder to something like plugins_old. Then check your site again.

SFTP rename plugins folder

If it works, then you will need to test each plugin one by one. Rename your plugin folder back to “plugins” and then rename each plugin folder inside of if it, one by one, until you find it. You could also try to replicate this on a  staging site  first.

Rename plugin folder

8. Check Redirects on Your Server

Besides HTTP to HTTPS redirects on your server, it can be good to check and make sure there aren’t any additional redirects setup wrong. For example, one bad 301 redirect back to itself could take down your site. Usually, these are found in your server’s config files.

Apache .htaccess file

Kinsta only uses Nginx, but if you’re using a WordPress host that is running Apache, it could very well be that your  .htaccess  file has a wrong rule in it. Follow the steps below to recreate a new one from scratch.

First,  login to your site via FTP  or SSH, and rename your  .htaccess  file to  .htaccess_old . This ensures you have a backup.

Rename .htaccess file

Normally to recreate this file you can simply re-save your  permalinks  in WordPress. However, if you’re in the middle of an ERR_TOO_MANY_REDIRECTS error you most likely can’t access your WordPress admin, so this isn’t an option. Therefore you can create a new  .htaccess  file and input the following contents. Then upload it to your server. The following uses the default settings.

See the  WordPress Codex  for more examples, such as a default  .htaccess  file for multisite.

We’ve taken our knowledge of effective website management at scale, and turned it into an ebook and video course. Click to download The Guide to Managing 60+ WordPress Sites !

Nginx Config

If your host uses Nginx, this file can be a little trickier as the config file can vary a bit depending on the hosting provider. We recommend reaching out to your host and have them check your config file for anything that might be causing a redirect loop or too many redirects.

If you’re a Kinsta client, you’ll first want to check to ensure you didn’t set up a redirect wrong in our redirect tool . Below is a simple example of a redirect from back to itself, that would cause a redirect loop.

Bad 301 redirect

This also commonly happens when the location URL is included in both “Redirect From” and “Redirection To.”

For example, the following would cause a redirect loop:

Redirect From:   ^/blog/about   Redirect To:

Why? Because once the process reached  ^/blog/about , the remaining part  -me  wouldn’t matter, and it would cause an infinite loop. You have to specify the end of the string and the starter point. Here is what you would do to fix it:

Redirect From:   ^/blog/about$   Redirect To:

The $ character will tell Nginx to stop and match the request only if the string is there exactly, but nothing after it.

And of course, you can always open up a support ticket and we’ll check this for you.

Misconfigured Reverse Proxies

Another common reason for the ERR_TOO_MANY_REDIRECTS error is if you are using a reverse proxy . Reverse proxies can be quite complicated and it’s very easy to send your WordPress site into a redirect loop if misconfigured. Again, if you’re a Kinsta client, our support team can help with this.

Redirect loops can sometimes be tricky to track down. But hopefully, some of the troubleshooting steps above help you to resolve your ERR_TOO_MANY_REDIRECTS error. If we missed anything, feel free to let us know below in the comments.

safari 301 redirect

Brian Jackson

Brian has a huge passion for WordPress, has been using it for over a decade, and even develops a couple of premium plugins. Brian enjoys blogging, movies, and hiking. Connect with Brian on Twitter .

Related Articles and Topics

safari 301 redirect

How to Fix a 500 Internal Server Error on Your Site

Featured image for HTTP to HTTPS migration

In-Depth HTTP to HTTPS Migration Guide for WordPress

Gravatar for this comment's author

Great tutorial and I solved my problem by turning SSL flexible to full. Thank so much!

Gravatar for this comment's author

Great, glad the SSL settings change fixed it for you!

Gravatar for this comment's author

That was really helpful and led me to the solution I needed. Thank you!!

Gravatar for this comment's author

Thanks dude. My website is working like normal again!!

Redirect loops can be frustrating. Glad you got it working again Dany!

Gravatar for this comment's author

Same here … changed ssl from flexible to full got my site working again. Over 2 hours of scratching my head and then found ezzeddin’s comment above, tried and it worked. Pheeeww… :-)

Hey Johnny, We do recommend changing SSL from flexible to full in the steps above. Glad you got it working!

Gravatar for this comment's author

I am soooooooo thankful, I changed my SSL from flexible to full and I successfully logged in. Again thanks!!!!!!

Gravatar for this comment's author

Thanks a KAJILLION. Chankging from Fleible to Full on Cloudflare certainly did the trick! So good to sort that little headache out! Thanks again Brian, Mark

Gravatar for this comment's author

Very helpful, the wp-config trick worked for me as I had changed the settings to force https and it caused this problem. Thanks!

Glad to hear it worked for you John!

Gravatar for this comment's author

Thanks! Man, the problem on my end was caused by Cloudflare Crypto! Great article! Much appreciated.

Gravatar for this comment's author

I spent more than 24 hours helplessly searching the internet for a solution to this problem and trying out every recommended solution that I could follow with no luck.

And then I decided to do another Google search on my mobile while in bed getting ready to give up for the day and this post happened to be the one I clicked on. Changing my Cloudflare crypto settings from Flexi to Full solved the problem. Thanks a lot you truly saved me.

Gravatar for this comment's author

Site is working after changing Cloudflare SSL setting to full.

Great, glad to hear it! Cloudflare’s crypto settings are often a common cause of the error.

Gravatar for this comment's author

Same here. Big relief. Thank you!

Gravatar for this comment's author

This problem gone away for me by fixing .htaccess file that had http links in it. You need to either comment the lines out with http or correct them to https

Gravatar for this comment's author

Good article. I really helped me solve the problem.

Gravatar for this comment's author

I have problem due to cloudflare and your solution worked. Thanks a Lot.

Gravatar for this comment's author

Thanks for the info. WP Noob here and I made the problem myself.

Gravatar for this comment's author

Great guide, sorted me right out.

Gravatar for this comment's author

Hello there, thank you for the article. Updated the same by changing to full in Cloudflare, but still, the site is not live. updated the WordPress URL and home also and purged too. Please help

Gravatar for this comment's author

Hello Brian,

Thanks for this informative article, much appreciated. I found out there was an issue regarding this SSL, got it changed from SSL flexible to full and now I am able to log in again.

Hey Prateek! Glad to hear it worked for you. Cloudflare’s SSL settings are often a common cause of the error.

Gravatar for this comment's author

This is a great article—I truly appreciate all this information. Sadly, my problem with redirects seem to fit NONE of these examples; but it is wonderful to have this as a checklist.

Hey Robert! Yes, unfortunately, due to so many different setups and configurations out there we might not be able to share every solution. However, if you figure out what was wrong on your site, let us know. We’d love to add it to the post. Thanks

Gravatar for this comment's author

I don’t normally leave comments but I just wanted to say thank you for putting this together! After watching several youtube videos and reading other blog posts that weren’t nearly as in depth I thankfully found your guide. 30 seconds later after making the recommended changes in cloudflare my site was back up and running!

Glad to hear you got it working it Sam! Cloudflare is definitely a common culprit for this error.

Gravatar for this comment's author

Why are all your guides so amazing? I came back to this one to tell you about the Cloudflare Flexible SSL thing, but you already have it. Awesome, as always.

Thanks for coming back to let us know either way James, we appreciate it! Cloudflare Flexible SSL is definitely one of the most common culprits we see causing this error.

Gravatar for this comment's author

Thanks for that. I was playing around with my WordPress blog and then was unable to make any changes to the post due to the ‘ redirected you too many times’.

I cleared the cache,cookies, even the browsing history – did not help. Then I tried to make a change to the post on Firefox and it worked- that lead me to believe it was an issue with Chrome so I whitelisted my blog through Settings -> Advanced Settings -> Cookies. Whitelisting/Allo and it works fine now!

Gravatar for this comment's author

Glad to hear the issue has been resolved!

Gravatar for this comment's author

“Another common mistake is that you’re not using the correct prefix to match the rest of your site, www or non-www.” I have remove www, and this cause permanent redirects. How can i do it right? Why it work only with www prefix? I want make it work with non-www.

Hey Vitalii! You should be able to do a search and replace on your site and make sure the syntax is the same (whether it is www or non-www) across your WordPress site. Check out our tutorial:

Gravatar for this comment's author

I was frustrated because of too many redirects issue..

Thanks for Redirect Mapper tool and your killer article

Gravatar for this comment's author

Yes, thanks this works for me. I have changed Cloudflare from flexible to full and problem solved.

Gravatar for this comment's author

Such a frustrating issue but thanks for your tips guys.

What worked for me was:

* Temp removing .htaccess * Temp change plugins folder name to plugins_old * Change SSL type in Cloudflare from Flexible to “Full”

I’m glad to hear it has been resolved Rob!

Gravatar for this comment's author

Thanks for this clear and comprehensive article – it helped me resolve most of my redirects issues but still struggling with a final status code of 403.

I miss Kinsta so much! Used Kinsta at a former employer but can’t afford it for my personal sites, sadly. I still get the newsletter and read most of the articles you publish.

Hi April, we have a detailed guide on troubleshooting 403 errors with WordPress . Please take a look hopefully it will provide you the answer. Also, thank you for your kind words. Hopefully, we can work together in the future!

Gravatar for this comment's author

I don’t usually leave comments but thank you so much. After hours of research and cracking my head you fixed my problem in a minute. I’m grateful. Thank you.

Gravatar for this comment's author

Life saver. Litespeed was storing an infinite redirect in the cache, clearing solved the issue.

Gravatar for this comment's author

Thank you, CloudFlare was the problem in my case.. I needed to switch to Full or Strict mode… T h a n k s !

Gravatar for this comment's author

Thanks a lot for this amazing post. I changed my server but after installing backup I was facing this issue. Thankfully it resolved, my SSL was not configured in the new server. Thanks a lot.

Gravatar for this comment's author

Thank you for your comment Anindya! I’m glad to hear you were able to resolve your SSL issue.

Gravatar for this comment's author

Thank you so much Brian! In my case, setting up WP_SITEURL was the way to solve the problem, but after moving to a dedicated server, there were so many problems, I could’t find the solution right away… Thanks for helping me out on this one ^__^ Best regards from Poland!

Gravatar for this comment's author

I just figured out another solution for those that created a new FB account and got the redirects.

The problem: I firstly created a new FB account on desktop and when I tried to confirm the account via email address it would then do the redirects

Solution: Using your mobile, try logging in, if it’s still redirecting then force stop the app and reload the app, confirm email address should appear there and enter it that way.

Log back into desktop and works again.

Gravatar for this comment's author

Very helpful – thank you. Deleting old .htaccess file and adding new did the trick.

Gravatar for this comment's author

You’re a lifesaver. Thank you!

Leave a Reply Cancel reply

By submitting this form: You agree to the processing of the submitted personal data in accordance with Kinsta's Privacy Policy , including the transfer of data to the United States.

You also agree to receive information from Kinsta related to our services, events, and promotions. You may unsubscribe at any time by following the instructions in the communications received.


What is a 301 Redirect & How To Set Up it (2 methods explained)

' src=

What Is 301 Redirect?

301 Redirect is used to guide search engines and your site visitors to a different URL which isn’t the one which they choose from a search engine results page and neither the one that they initially typed into their browsers.

301 redirects

Image Source: netdna-ssl

In order to set up 301 redirect properly (technically) on your website, you can hire an experienced web development company who has a wealth of experience in preparing seamless redirecting maps and implementing them in the best possible way.

But in spite of hiring a professional, it’s equally important for you to gain an idea of how these redirects work and for which reasons you should use them?

When do I need to setup the redirection?

  • You have a brand new website and you want a permanent redirect
  • Broken pages or URL
  • When moving to HTTPS
  • Overhauling your web portal (redesigning)
  • Altering URLs for any reason
  • When removing content or fixing some content related issues
  • Resolving dynamic URL problems
  • Changing or merging domains
  • Maximizing domain authority by linking web conversions with one URL

How the redirection works?

Basically, a 301 redirect command let the site visitors and search engines know that a particular page has been moved to a different page permanently. While 302 redirect indicates the page has bee moved temporarily.

The entire process can be divided into the following three steps:

  • A user or search engine arrives on an original URL
  • The 301 redirect command takes them to the new URL which is not the one which they have typed in the browser.
  • Rewriting URL process starts all over again

Let’s explore an image showcased on Moz in order to understand the entire process in which 301 redirects actually work:

301 redirects working

How Redirection Impacts SEO & Rankings?

Page rankings or SEO performance of a website gets directly influenced by 301 redirects. It can have either a negative or positive impact on the page rank of your web portal.

Having experience in implementing 301 redirects properly can be an integral tool to optimize your website for increased conversions .

301 redirects are also known as permanent redirects and hence all the qualities of the redirected page such as MozRank, page authority, traffic value, PageRank, etc. will get attributed to the detour page.

This makes the detour page represents the redirected one completely.

As a result of 301 redirects, the old page gets eliminated from Google’s index and the new one take its place.

Gradually, Google, as well as the other major search engines, starts giving your new domain preference over the old one in terms of SEO rankings.

Let’s understand it with the help of a flowchart:

301 redirection

Image Source: Hostinger

With the help of 301 redirects, it becomes easier to repurpose old content and make website redesign seamless. Also, it helps in the smooth transfer of authority and proper redirecting set up boost the SEO performance of your website.

Let’s look at a few key benefits of implementing precise 301 redirects:

  • There is no chance of duplicated content as search engines will consider the redirected page as a separate entity.
  • Your daily site visitors will not reduce and they won’t land on a page with a “404 page not found error”.
  • Your page rankings will remain intact and you can easily transfer the authority of the old URL to the new one which will help you in retaining your followers by redirecting them to the detour page.

How To Set Up 301 Redirect?

Well, there are a couple of ways which web experts can use for setting up 301 redirects. These redirects can be easily set up for both a single web page or an entire domain.

Method 1. Editing the .htaccess File

You can set up a 301 redirect by editing your .htaccess file and for doing this you have to sign in to your Account Control Center (ACC) and go to the left sidebar and click on Domains.

Select the “Manage Your Domains” feature from the drop-down list and choose the one that you would like to redirect.

Now you have to go to “Manage Web Settings” which you can find from the drop-down list of the Web Settings section.

You need to click on the “View or Edit Your .htaccess File” option in case you already have a .htaccess file.

But if you have never created such a file you can click on “Create a .htaccess File” option. Let’s understand this process with the help of a screenshot:


Image Source: Pair

Finally, to set up 301 redirects you need to include a few lines into your .htaccess file which can be further divided into two main categories:

  • Redirect 301 / (Setting up a redirect for a single web page)
  • Redirect 301 /old-file.html (Setting up a redirect for an entire domain)

After finishing this step you only need to click Save Changes if you already had a .htaccess file. Or, tap on Create File for adding new .htaccess files.

Method 2. Using WordPress Plugins

WordPress redirection plugin can also help webmasters in setting up 301 redirects. Also, this plugin can help in keeping a track of 404 errors.

You can find this plugin in WordPress plugin directory.

Redirection WordPress Plugin

Image Source: Inbound Now

For doing this first you need to install and activate the plugin. After completing the activation process you have to visit the “Tools” section and click on “Redirection” to set up your redirects.

Here you can pop in the old URL as well as the new destination URL. After inserting both of these you just have to tap on “add redirection” in order to complete the setup process of 301 redirects.

You can look at the image given below and understand how to execute the entire process.

Setting up new redirection

Image Source: WPBeginner

301 redirect can help your web portals perform better in terms of SEO and retain its visitor base if executed properly.

But an inappropriate approach towards setting up these redirects can hurt your page rankings and can make you lose your precious customers.

In a nutshell, a 301 redirect can be easily set-up by following the above-mentioned best practices. Moreover, it can be one of the best tools to optimize your website for maximum visibility.

Also, through 301 redirects you can make sure that the online traffic is guided towards the most updated version of your URL.

But, for ensuring that these redirects would not have an adverse impact on your rankings and organic traffic, having an appropriate approach towards setting them up is mandatory.

So, we wish you good luck with your next web portal redirect strategy and may it gives you an opportunity to reap rich rewards in the future.

I’m Chris Wagner, Head of Content @ HostingPill.

I regularly write about Hosting, Web servers and WordPress.

I have more than 9 years Industry experience.

Are you an enthusiastic tech-lover who keeps up with everything that moves in the trends? Or do you know computers inside out & can tell what makes it tick just by the look of it?

Well, we’ve been looking for you!

HostingPill is looking for Content Writers who have the skills to synthesise complex tech jargon into layman’s tongue and present it in an interesting article format.

safari 301 redirect

safari 301 redirect

Redirecting URLs: How To Use & Implement 301 Redirects

By Matthew Edgar · Last Updated: July 21, 2023

A redirect routes visitors from one URL to another URL. Redirects can be useful to fix 404 errors or to prevent errors when changing URLs. However, it is important you configure redirects to send visitors to the correct URL. Improperly configured redirects can result in other errors, like redirect chains or loops, which will be discussed later in this guide. In this article, we’ll cover all aspects of working with redirects, including implementing 301 redirects.

Table of Contents

  • What Is a Redirect?

Why use a 302 temporary redirect?

  • What are 307 or 308 Redirects?
  • What are redirect chains?                      
  • What are redirect loops?  

How do you clean up redirect chains and loops with ChatGPT?

How do redirects impact traffic, how long should i keep redirects, how do you use 301 redirects to fix 404 errors, how do you use redirects to avoid 404 errors during a redevelopment, what page should you redirect to.

  • htaccess 301 redirect
  • WordPress redirects
  • Client-side Redirects
  • Google Search Console

Other Methods of Testing Redirects

What is a redirect.

A redirect is a piece of code instructing the server to forward (or redirect) any requests made at one URL to a different URL. The URL you are redirecting from is called the redirect source (or redirect origin ) and the URL you are redirecting to is called the redirect destination (or redirect target ).

Once a redirect is implemented, any visitor or robot attempting to access the redirect source URL will be routed to the redirect destination URL. When the server processes this redirect, an HTTP response status code is returned to the browser to indicate that a redirect has occurred and clarify what type of redirect it is. The most common redirect status code is a 301 response , which indicates this is a permanent redirect. A 302 response status code would indicate the redirect is temporary. (Side note: there is some anecdotal evidence that Google might treat 302 redirects as 301 redirects in some cases but, even still, a 301 is a clearer signal to send.)

Common Redirect Questions

If the redirect is truly temporary, then a 302 response code on the redirect is the right solution. For example, if you are temporarily shutting down a promotion page on an e-commerce website but will re-open that promotion page in a few days, a 302 would be appropriate. A 302 can also be appropriate when redirecting to new URLs if there is a chance of reverting to old URLs during a limited test phase.

What are 307 and 308 redirects? 

A 307 or 308 response status are status codes available in HTTP 1.1. A 307 response indicates a temporary redirect and a 308 indicates a permanent redirect. The 308 code is supported by Google and treats a redirect returning a 308 status like a 301 redirect. As both status codes are supported, you do not need to change your current 301 redirects to a different status code.

A 307 response code on a redirect is most often seen within testing tools, including Google Chrome, when testing redirects between non-secure and secure websites. The 307 response status is returned in the browser even though the server may not be configured to return a 307 redirect. That’s because browsers are redirecting to https using an internal redirect and internal redirects return a 307 status. Internal redirects are not seen by Googlebot because this type of redirect isn’t a “real” redirect returned from the server. If you see a 307 response status in the browser, you’ll need to check what status code the server is actually returning as that will be the status code seen by robots (including Googlebot).

What are Redirect Chains?

A redirect chain is where several URLs redirect from one to the next to the next. Each step in the chain is a redirect hop. Example: -> -> ->

In this example, the redirect source is and the final redirect destination is However, the redirect takes three hops to arrive at that destination, creating a redirect chain. Note that the URL redirects to in two hops.

Robots waste resources crawling through these redirect chains and may simply stop following the chain after a certain number of hops, meaning the robots may not locate the final destination of the redirect chain. Chains can also lead to slower speeds (learn more about how redirects slow down a website ).

As much as possible, chains should be avoided. In the above example, the redirects from and should both be updated to redirect to in one hop. If a chain cannot be avoided completely, chains should be reduced to as few hops as possible.

What are Redirect Loops? 

A redirect chain that circles back onto itself is called a redirect loop. No destination can be arrived at by following redirects in a loop; visitors will be unable to access any pages within the redirect loop. Robots will waste crawl budgets when encountering loops. Human visitors and robots will both encounter error messages due to redirect loops. 

Here is an example of a redirect loop. This starts at and redirects through a chain back to -> -> ->

Instead of addressing chains and loops manually, you can use ChatGPT to clean up redirect chains and loops on your website.

  • The first step is exporting your existing redirects into an Excel spreadsheet. If you are using Redirection in WordPress, you can select “Import/Export” to download the CSV file. You want to download “Everything” under Export options. The CSV can be opened in Excel. If your redirects are defined on your website’s .htaccess file, you can open the .htaccess file in Excel. On the import wizard screen, you can select “space delimited” and then the redirects will be added as new columns.
  • Next, you want to clean up your Excel file so that your redirect source is in column A and your redirect destination is in column B. For the purposes of cleaning up the chains and loops, you can remove the data in the other columns.
  • You could, at this point, review the redirects manually to remove any loops or chains. Using ChatGPT, however, tends to be far more efficient when you have many redirects to check for loops or chains. The prompt to use for ChatGPT is: “Chat, below is a list of redirect sources and destinations, where the source is listed first and the destination second. Please check if there are any redirect chains or redirect loops within these redirect statements. If loops or chains are found, please rewrite the rules to avoid those issues and return the results as a table.” After this prompt, copy and paste the data in the Excel file below the prompt text. Depending on the size of your redirects, you may need to paste this in multiple batches. If that is the case, tell ChatGPT you will be pasting in multiple batches and to wait to clean up the redirects until you tell it you’ve pasted the final batch.
  • ChatGPT will then process the redirects. If any redirect chains or loops are found, ChatGPT will return a table with the corrected redirects. If no issues are found, it will tell you.
  • You can ask ChatGPT to format the updated redirect rules into a CSV file that you can upload to Redirection in WordPress. Or, you can ask ChatGPT to format the updated redirect rules into an .htaccess file that you can upload. Remember! Before uploading the redirects, check that the updated redirect rules are correct. ChatGPT is helpful but not flawless.

Even when adding a redirect correctly, you will  often see a dip in traffic  from Google and potentially a dip in rankings in Google search results as Google learns about the redirect and the new URL. This can be especially problematic during a website redesign, though redirects can be a key part of recovery.

The length of time for Google to adjust will vary with some reports saying Google recognized redirects within a matter of hours and other reports suggesting it can take months. For more, see my article about  how long to keep redirects .

One way to fix not-found errors on your website is by adding redirects. Let’s say, for example, that /login is a 404 not-found error on your website. To fix that error, and prevent people from encountering the error, you can add a redirect /login (the 404-error page) to /login.html (a working page on that website). That way, if anybody attempts to access /login, they will instead be taken to /login.html and avoid the redirect.

You can also add preventative redirects if there is a good chance a URL might be typed incorrectly. This is especially important for URLs used in offline advertising. For example, a brochure might tell people to visit Some people might forget the “e” at the end of the word, so it would make sense to redirect to before the brochure is distributed so that all customers can access the page.

When you are updating your website, as part of a redesign, redevelopment, or some other type of major overhaul, you will occasionally need to change the URL of a few pages. When you change the URL, anybody attempting to access the old URL will receive an error message saying that URL can no longer be found. Instead, you want to redirect visitors and robots who attempt to access the old URL to the new version of the URL to prevent a 404 error from ever occurring.

In some cases, every URL (or almost every URL) will change as part of the redesign or redevelopment. One of the most common reasons for this is when you are moving your website to a new platform. The platforms may generate different URLs (e.g. page.aspx instead of page.php) or the new platform might force a directory structure (e.g. all blog posts must be in a /blog/ directory). This is an area to evaluate when selecting new platforms; a platform that requires no (or only a few) changes to URL structure is preferable since it reduces the need for redirects and lessens the chances of losing traffic with a redesign .

When transitioning a website with only a few pages with changed URLs, redirecting each page is easy. But if you have lots of pages with changed URLs (for example, thousands of product pages all have changed URLs) sometimes it is more practical to only select the “best” pages to redirect. This may include redirecting pages with several external links, high traffic volume, a high number of social shares, a higher conversion rate, or some combination of those factors.

Deciding where some URLs should redirect to is easy, especially for updated pages. For example, a page about an old product might have been removed from the website, but there is a new version of that product. In this example, the URL of the removed page should redirect to the URL of the new page. 

What about pages that do not have a new version? In these cases, the removed page’s URL should redirect visitors to a page that meets similar expectations as the removed page. For example, an old product page was removed and there is no new version of the product, but a redirect could route visitors to a category page that lists products similar to the product that was removed.

It is important to avoid redirecting visitors to a page that isn’t something people wouldn’t expect as this is frustrating and confusing. Let’s say, a visitor is trying to find a product you no longer carry but that old URL redirects me to your website’s about page—the about page has nothing to do with the product the visitor was interested in.  One common example of this is the home page. The home page is broadly focused, so the chance the home page will be similar enough to the removed page visitors wanted to find is unlikely. 

If there is no relevant page to redirect to, it might be better to not add a redirect at all and, instead, let the removed page return a not-found error. When reaching an error message, especially a  well-crafted error message , visitors know the page they were hoping to access is no longer available instead of being confused after being redirected to an irrelevant page. 

How To Implement Redirects

There are two different ways to implement a redirect: in client-side code or in server-side code.

  • Server-side redirects . Defined in server configuration files, these redirects are processed on the server (Apache, Nginx, Windows, etc.) before any content is sent to the browser. The server sends an HTTP response with the appropriate status code (e.g., 301, 302, 307) and the URL the browser should redirect to in the ‘Location’ header .
  • Client-side redirects. In contrast, JavaScript redirects are processed in the browser after the initial page containing the JavaScript code is loaded into the browser and executed by the browser. The JavaScript code modifies the browser’s location object (window.location.href) or uses a method like window.location.replace() to trigger the redirect.

Server-side redirects are generally the fastest method because they minimize the number of HTTP requests. Server-side redirects also avoid loading and processing the initial page into the browser. Simpler is better, especially when it comes to search robots. As a result, search robots are able to reliably and consistently follow server-side redirects. Users are also typically unaware that a redirect has occurred because of how quickly server-side redirects are processed.

In contrast, client-side redirects require loading, parsing, and executing the JavaScript code on the initial page before the redirect can occur. This results in an extra HTTP request and additional processing time. Search robots can typically process these redirects assuming they can successfully load the JavaScript code (which isn’t always the case). However, these redirects often are more troublesome for users because a user watches the initial page load only to then see that page redirect elsewhere.

Server-Side Redirects

A server-side redirect is a redirect processed by a web server. These types of redirects can be configured in a number of different ways. Most often server-side redirects are configured via the .htaccess file (on Apache – see below) or  via a web.config file  (on IIS/Windows). There are also several other ways to  handle redirects in a variety of programming languages . 

When configuring a server-side redirect, you want to make sure the server returns a 301 response status code to indicate the redirect is permanent. A 302 HTTP response code, which indicates the redirect is temporary, is often the default setting on most servers.

htaccess 301 Redirect

An .htaccess file is a control file for Apache servers. (You can find out what kind of server you are on by using a tool like  BuiltWith .) The .htaccess file is located in the main directory (or root directory) of your website (make sure to view hidden files). In the .htaccess file, you can put a number of statements telling the server what to do, including statements about redirects. 

Here are the steps to add a 301 redirect to the .htaccess file:

  • To create the statement in the .htaccess file, you want to first state that you are making a redirect with the statement  redirect .
  • Next, you want to define the type of redirect. In this case, we want to permanently redirect the URL, so the redirect type is 301.
  • Then you want to state the URL of the redirect source. To use the example above, let’s say we are fixing the broken link of “/login”. So, the redirect source URL to state in the .htaccess file code is /login. Note that, this URL shouldn’t include your website’s domain (this is called a relative URL).
  • Finally, you want to state the redirect destination. In the example above, “/login.html” is the working version of the page and therefore, this is the URL we want to redirect to. We’ll state this by adding For the redirect destination URL, it is best to include the domain name to make the redirect clearly stated (this is called an absolute URL).

Putting it all together, the line in your .htaccess file looks like this: redirect 301 /login After saving the .htaccess file to your server, the next time you visit, you will be redirected to

WordPress Redirects

For WordPress (and other CMS systems), there are plugins that will help with configuring and managing redirects. The plugin I’ve found works the best for clients and that I highly recommend using is called, simply,  Redirection . Once installed, Redirection can be located under the “Tools” menu. From the main page, you can edit existing redirects or you can add a new redirect.

WordPress Redirection plugin

On the add new redirect screen, the “Source URL” is the URL you are redirecting from (the redirect source or origin), and the “Target URL” is the URL you are redirecting to (the redirect target or destination). The Redirection plugin also allows you to handle redirects with regular expressions and also lets you group redirects for better organization. By default, Redirection will set the redirect as a 301 but if you want to change that, you can click the gear icon for more options and set the redirect to a different response code.

Client-Side Redirects

Redirects can also be implemented in client-side code via JavaScript using one of two methods. Both methods will redirect and all three are generally supported by Googlebot. However, each method will redirect the visitor in slightly different ways.

Method #1: window.location.href

Code example:

redirect_to_url = ""; window.location.href = redirect_to_url;

Using window.location.href is similar to clicking a link using JavaScript code. If you use this method, the current page will be kept in the browser’s history. So if the user clicks the “back” button on their browser, they will return to the original page. If that original page redirects, however, that can create a frustrating experience for a user.

There is a way to do something similar with the code: window.location.assign(redirect_to_url); The difference is semantic. When you use window.location.assign(redirect_to_url), you’re specifically invoking a method to load a new document. When you use window.location.href = “redirect_to_url”, you’re changing the property of the window.location object, which implicitly loads a new document.

Method #2: window.location.replace()

redirect_to_url = ""; window.location.replace(redirect_to_url);

The window.location.replace() method is the most similar to a server-side redirect and is typically the best method to use for client-side redirects. If you use this method, the current page will not be kept in the browser’s history. If the user clicks the “back” button on their browser, they will not return to the original page but instead to whatever page was in the history before the original page.

Testing Redirects

Google search console .

To check that a URL redirects in Google Search Console, you can use the URL Inspection tool by entering a URL in the search box at the top of the screen.

safari 301 redirect

Google Search Console will then return the results indicating what they know about the URL. If Google’s bots have previously crawled the URL, you will see a note that this URL is a “Page with redirect”, which is what we’d expect to see for a correctly implemented redirect. Note that a page with a redirect will not be indexed. Learn more about Google’s Page Indexing reports and why these pages are not indexed.

safari 301 redirect

Another way of testing a redirect is to use a tool like  WhereGoes . In WhereGoes, you can enter a URL, confirm that the proper response is returned when it is redirected, and confirm the URL redirects to the right location. Begin by entering the URL on Where Goes’s main screen and then click “Trace URL”. offers a simple tool to check for redirects.

The result will then be returned. In this example, you can see that /tech-seo/controlling-search-robots/ on my website redirects with a 301 response to the /noindex-vs-nofollow-vs-disallow/ article. 

In Where Goes, you can see where a URL redirects and what redirect type is used

Get Help With Your Redirects

Want help with your website’s redirects or have more questions about redirects?  Contact me today  to discuss how I can help. Or, if you prefer a more DIY approach, order my book,  Tech SEO Guide , a reference guide to help you address redirects and other technical SEO issues affecting your website.

You may also like

How to use a headless browser.

Learn what a headless browser is, why you should use a headless browser and how to launch a headless browser on your own computer.

Handling Out of Stock & Removed Product Pages

How do you remove products from your website without harming your users or SEO performance—or at least minimize the harm? In this post, Matthew walks through the different options available.

How to Check HTTP Response Status Codes

Every page on every website returns an HTTP response status code. How do you check the status code for your website’s pages? What tools can you use to test status codes? What do the status codes mean?

safari 301 redirect

301 redirects: what they are and how to use them

When you move or delete pages on your website, 301 redirects help keep traffic flowing. Learn how 301s work — and the best practices for SEO.

safari 301 redirect

301s help your website visitors — and search engines — find their way when your website changes.

As your website grows and evolves, changes are unavoidable. You’ll likely need to move, archive, combine, or delete certain pages — or possibly your entire site. 

That’s where 301 redirects come in. They’re a helpful tactic to make sure traffic keeps flowing to the right pages on your site, but you’ll want to use them correctly. 

In this post, we’ll cover:

  • What 301 redirects are
  • Why they’re important for SEO
  • When to use a 301 url redirect
  • 301 vs 302 redirects
  • Best SEO practices for 301s

What is a 301 redirect?

A 301 redirect is a type of HTTP status code . Web browsers and site servers use these three-digit codes to communicate information about the status of a website or page. For example, when you go to visit a website, your browser requests access from the site’s server, and the server responds with a HTTP status code. 

The 301 status code is for permanent redirects, meaning that a page has been permanently redirected to another URL, and all visitors and bots will be automatically sent on to the new location. As a visitor, this usually happens almost instantaneously, though you may notice the target URL in your browser changing to the new page. 

You can manually set or remove 301 redirects for your website to ensure traffic flows to the right pages, which creates a more fluid and positive experience for site visitors. When you skip the step of setting a 301 redirect, you can end up with “dead ends” on your site — leaving your visitors stranded. 

Why are 301 redirects important for SEO?

301 redirects don’t just send website visitors to the right location — they also send bots to the right location, including the web crawlers that index content for search engines like Google. 301 redirects are crucial for search engine optimization (SEO) because they help ensure your website is crawled and cataloged accurately. 

Additionally, when you move a page for any reason, you want to make sure that any backlinks to your page remain intact. 301 redirects help make sure external links take visitors (and Google crawlers) to a relevant page on your site, continuing to drive traffic and retain the SEO value of your hard-earned backlinks. 

And when you need to move a page that ranks for certain keywords, a 301 redirect will maintain the page’s link equity (or “SEO juice”) by passing it onto the new URL. This means content teams can use 301 redirects strategically to optimize search rankings. For example, you could choose to combine similar pages that may rank for the same keyword into one consolidated page — and ideally combine the ranking potential of each individual page at the same time. (We’ll get into more examples of how to use 301 redirects for SEO in the next few sections.)

When to use a 301 redirect

301 redirects can be used across several scenarios, including:

Moving a page to a new URL

This is the simplest use case for a 301 redirect: moving an existing page from one URL to another. This happens for all kinds of reasons, such as renaming a product or recategorizing a blog post. Using a 301 redirect will deliver a seamless user experience and ensures Google and other search engines index your new page accurately and pass on any ranking power from the previous page.

Migrating a website from an existing domain to a new domain

Situations such as a rebrand, moving from a .net to a .com, or moving away from a subdomain might require you to move from your existing domain name to a new one. You can use 301 redirects to make sure all your old URLs are sent to new URLs — just be sure to plan ahead. Migrating from an old domain to a new domain requires careful mapping in advance as you may want to flag outdated content for removal or consolidate similar pages. 

Deleting pages

If you delete a page from your site and take no other action, your site will send traffic to a 404 error page , which indicates that the content they were looking for can’t be found. This is frustrating for users, and not ideal for SEO. 

Before deleting a page, consider which other pages on your site might be good substitutes. If you have one that makes sense, set up a 301 redirect so visitors can still find what they’re looking for. 

If there isn’t a relevant page on your site, you can choose to let traffic dead-end on a 404 (not found), which indicates a page has been permanently removed. This may be a better experience for your visitors than sending them to your homepage, which could be confusing or annoying for visitors. 

Redirecting an entire domain from HTTP to HTTPS

Modern best practices call for websites to use the more secure HTTPS protocol over HTTP. HTTPS delivers an extra layer of security by using SSL (“secure sockets layer”) to encrypt data that passes between a web server and a browser. 

Switching your URLs from HTTP to HTTPS is usually straightforward, but you will want to use 301 redirects to make sure Google indexes the right content and traffic is sent to the right pages. 

Resolving duplication issues

Having search engines index different variations of your site isn’t ideal for SEO. But certain technical scenarios may result in having more than one version of your pages — or even your entire website — published by mistake. It’s important for Google to always understand which content to crawl and catalog. Using 301 redirects can help resolve duplication issues in the following situations: 

Moving from non-WWW to WWW URLs

To avoid duplication, you want to make sure your site is consistently using either non-WWW URLs ( ) or WWW URLs ( ). It doesn’t matter which, but if you need to remove duplicate pages from either structure, use 301 redirects to send traffic to the correct version. 

Eliminate trailing slashes in URLs

Similarly to WWWs, pages with trailing slashes ( ) and without them ( ) are viewed as different URLs by Google. Use 301 redirects to make sure your page URLs use trailing slashes — or not — consistently. 

Resolving uppercase vs lowercase discrepancies in URLs

The same principle applies to URLs that use uppercase ( ) and lowercase letters ( ). Different versions of the same page will be seen as duplicative, so use 301 redirects if you find this is happening on your site. Most web pages use lowercase for URLs. 

Consolidating content to improve search rankings

As we mentioned earlier, 301 redirects can play a key role in strategic changes to your content that can optimize your SEO rankings on search engine results pages (SERPs). 

For example, if you have two pages both ranking fairly well for the same keyword, you can choose to thoughtfully combine those pages and redirect the lower-ranking URL to the higher-ranking page. This helps you avoid keyword cannibalization on your site, and consolidates each page’s authority with Google into a single, more powerful page. Or, you could redirect both existing pages to a brand new URL.

You can also use 301s during SEO pruning : identifying thin or underperforming pages and merging them into one, or simply removing the content and redirecting those URLs to higher-performing pages. 

Changing your site structure

If you want to change your subfolder structure on your site, you can use 301 redirects to move traffic from the old URL to the new. For example, you may choose to reorganize your blog or ecommerce categories, and move pages like to . Or, you may decide to make a change like removing publishing dates from blog URLs. In that case, you’d want to use 301 redirects to ensure no traffic gets dropped along the way. 

Get 13 need-to know tips on website SEO — whether or not you use Webflow.

301 vs 302 redirects 

One quick note: there are multiple HTTP status codes in the 300 category, each of which indicate some type of redirection. 301 redirects indicate a permanent change, while 302 redirects indicate a temporary change. 

302 redirects are used when you need to move a page temporarily, but intend to move it back to the original URL. This can happen during A/B testing, phased website launches, or when using a temporary holding page. 

While Google representatives have said that 302 redirects receive the same page ranking benefits as 301s, some SEOs believe a 301 passes on stronger signals to Google. So unless you know for certain you’re moving the page back to the original URL, use a 301 redirect instead of a 302.

There are a few other types of redirects to be aware of:

  • 307 redirects are another kind of temporary redirect, similar to a 302
  • Meta refreshes use meta tags to send users to a new URL, but Google doesn’t recommend using them
  • Javascript redirects use scripts on the page to move users to a new page, but most SEOs (and Google representatives ) don’t recommend using them 

301 redirect best practices for SEO

Match the intent of your redirected pages.

Always have your user in mind when you set up a 301 redirect. If the link they click on or the URL they type into their browser ends up taking them to a new page that doesn’t match up with what they were expecting to see, that creates a negative experience and may lead them to leave your site altogether. Only redirect to similar pages with a similar intent. 

Update your sitemap when you implement 301 redirects

Your sitemap helps search engines know how to navigate and index your pages. And while Google may seem all-powerful, even their search engine crawlers have limited resources, so you don’t want to waste their time attempting to crawl pages that don’t actually exist anymore. 

So when you implement 301 redirects, update your sitemap accordingly. Or, if that’s impractical for your team, create a recurring task for the right specialist to audit your site for 301s and update your sitemap on a regular basis.

Don’t create redirect chains or loops

If you have multiple pages redirecting from one URL to another to another, known as a redirect chain,  it adds unnecessary complexity for search engine crawlers and could slow down your site. Whenever you redirect a URL, make sure to update any previous 301s to the new destination page. 

Also be mindful of creating redirect loops, where multiple 301s send users or bots on an infinite cycle of redirects that eventually ends in an ugly error page.

Redirect 404 pages whenever possible

If you audit your site and find 404 pages, take the time to look at the original URL and figure out the next best page for those links to point to. Then set up the 301 redirects to reduce the chances of traffic dead-ending on your site. 

But remember, make sure that page has matching intent. If there really is no better place for visitors to go, a creative 404 page may deliver a better experience than a page that doesn’t match their expectations.

Check organic traffic for redirected 301 pages

If your analytics tools are telling you that Google is sending traffic to a page with a 301 code, that means the redirect hasn’t been indexed by Google. While it should update automatically the next time Google crawls your site, you can speed things up by removing the page from your sitemap as described above and submitting the change to Google Search Console .

Update broken links—don’t rely on redirects alone

Finally, while 301s are incredibly handy to avoid broken links pointing to your old pages from external sites, you don’t want to over-rely on them. Take the time to update your own internal links to new URLs to provide the best possible experience for visitors and search engine crawlers.

‍ Want to learn more about optimizing your website for organic search? Check out our essential guide to SEO . 

Subscribe to Webflow Inspo

Get the best, coolest, and latest in design and no-code delivered to your inbox each week.

Related articles

safari 301 redirect

Everything you need to know about SEO audits

An SEO audit is necessary to ensure your website earns clicks. Here’s how to perform a complete SEO audit to check your site’s health.

safari 301 redirect

Exporting your Webflow website: The ultimate checklist

Webflow hosting is fast, secure, and easy to set up. But if you need to host elsewhere, you need to read (and save) this checklist first.

safari 301 redirect

How to build a website migration plan

Whether you’re looking to do a visual refresh, switch platforms, update your site structure or anything in between — you need a website migration strategy.

safari 301 redirect

502 bad gateway: What it means & how web developers can fix these errors

Everything you need to know about gateway errors, how to fix them, and how to prevent them from happening.

safari 301 redirect

Maximizing the SEO of your multilingual Webflow website

A comprehensive guide for creating a multilingual website in Webflow and optimizing multi-language content for search engines.

safari 301 redirect

Web standards: where they came from and why they exist

Web standards are a set of practical guidelines to ensure the web is accessible to as many people as possible. Learn the best practices for applying them.

Get started for free

Try Webflow for as long as you like with our free Starter plan. Purchase a paid Site plan to publish, host, and unlock additional features.

Transforming the design process at

  • Interactions
  • Localization
  • Figma to Webflow Labs
  • DevLink Labs
  • Feature index
  • Accessibility
  • Webflow vs WordPress
  • Webflow vs Squarespace
  • Webflow vs Shopify
  • Webflow vs Contentful
  • Webflow vs Sitecore
  • Careers We're Hiring
  • Merch store
  • Accessibility statement
  • Terms of Service
  • Privacy policy
  • Cookie policy
  • Cookie preferences
  • Freelancers and agencies
  • Marketplace
  • Libraries Beta
  • Hire an Expert
  • Made in Webflow
  • Become an Expert
  • Become a Template Designer
  • Become an Affiliate

What is a 301 Redirect, and When Should You Use One?

Jon Payne

Updated: March 09, 2022

Published: August 26, 2021

I moved five times in the last year. And every single time I moved, I forgot to sign up to have my mail forwarded to my new address.

person using a laptop computer to create a 301 redirect

Mail forwarding is an important step in any moving process, as it ensures you don't lose any valuable information that's sent to you.

And the same can be said for your website: If you're moving a website from one URL to another, you need to take the necessary steps to ensure your visitors get sent to the right place. In the world of tech, this is called a 301 redirect.

Here, we're going to discuss what a 301 redirect is and when you need to use one, as well as how to redirect a URL in HubSpot or WordPress. Additionally, we'll explore the differences between a 301 and 302 redirect.

How strong is your website? Grade it using HubSpot's free Website Grader.

What is a 301 (permanent) redirect?

301 is an HTTP status code sent by a web server to a browser. A 301 signals a permanent redirect from one URL to another, meaning all users that request an old URL will be automatically sent to a new URL. A 301 redirect passes all ranking power from the old URL to the new URL, and is most commonly used when a page has been permanently moved or removed from a website.

301 is one of many possible HTTP status codes , some of which you've probably heard of (including 404 - Not Found, 403 - Forbidden and, 500 - Server Error ). When you visit a web page and the server sends the page normally, the status code it attaches to that page is 200 - OK.

You can think of a 301 redirect like a mail forwarder. Once you've moved a piece of content away from a specific URL, anyone who tries to visit it will receive a 404 - page not found message.

To improve their user journey, you can ask the server to forward visits from the old URL to a new location — the new home of your piece of content — using a 301 redirect.

Now, when you attempt to visit the old URL, the server will send back the 301 - Permanently Moved status code, and then move you on to the new location.

This happens so quickly that you're usually not aware of it, and will simply find yourself on the piece of content for which you'd searched. You might notice that the URL is different from the one you clicked on or typed in. Or you might have a browser extension such as Ayima Redirect Path which lets you know when you've been redirected.

The other key role that a 301 redirect fulfills is with search engines. Having useful status codes that correctly signal where content has moved to allows search engines such as Google and Bing to keep their index up-to-date.

Essentially, a 301 redirect will let search engines know: "Hey, you know that piece of content that users enjoyed clicking on from the SERPs? Well, it now lives over here, so take all that visibility you associated with this page, and transfer it over to this new URL."

This is why 301 redirects are important for SEO .

Now that we've covered that, let's dive into how you can do a 301 redirect for yourself. 

How to Do a 301 Redirect In a CMS

The actual process of implementing a 301 redirect varies from CMS to CMS and platform to platform. While we aren't able to discuss the specifics of every CMS platform, we can take a close look at HubSpot and WordPress. Hopefully, these instructions should help you get started regardless of the CMS you use.

How to Redirect a URL in HubSpot

HubSpot makes it simple to add 301 permanent redirects inside the tool. To set up a redirect in HubSpot:

1. Click Settings (the cog in the top right corner).

2. In the left sidebar menu, navigate to Website > Domains and URLs .

the website menu for adding a 301 redirect in hubspot

3. Click the URL Redirects tab, then click Add URL redirect in the top right.

the domains and urls menu for adding a 301 redirect in hubspot

This reveals a right-side panel. We'll go over some use cases later, but for now let's look at the options in this panel.

In most cases, you will want to implement a single page-to-page redirect. In this case, choose Standard .

the redirect type menu for adding a 301 redirect in hubspot

Next, you'll want to add the Original URL and the Redirect to URL  for your old and new URLs, respectively.


Click Add URL Redirect and the redirect will be added to HubSpot.

We also recommend testing your redirect. First, wait a few minutes for the change to apply to the server. Next, try visiting the original URL in an incognito browser window and check that it works as expected.

In some cases, creating single page-to-page redirects is very inefficient. For example, if you have just moved an entire folder of content, you may have 15 pages within a subfolder that you now need to redirect. In such cases, it's a better idea to use a Flexible  redirect.

You can think of a flexible redirect as a formula or a rule. It will allow you to redirect everything within a certain folder to a different folder while keeping the rest of the URL the same.

When you select Flexible redirect, HubSpot will automatically provide you the link to the flexible URL pattern redirect help page , which will give you specific guidance on how to use the syntax for this feature.

More Options

Under More Options , HubSpot offers various advanced variations on these redirect types.

more options  for adding a 301 redirect in hubspot

It will allow you to deliver a 302 Temporary Redirect or a proxy redirect (redirect the content of a live page without changing the URL shown in the visitor's browser) instead, choose the order which HubSpot moves through the redirect rules when resolving a URL (which may change which valid rule is triggered), disable a redirect if content is present at the URL, preserve query strings, force HTTPS, and force trailing slashes on the end of all URLs.

How to Redirect a URL in WordPress

If you aren't a HubSpot customer, then you will need to apply 301 redirects differently. WordPress is the most popular CMS in the world , so it makes sense for us to touch upon how one might go about looking at redirects in a WordPress context next.

However, it's important to note that WordPress itself is very flexible. Installations of WordPress can vary wildly, and so there is no one-size-fits-all guide we can provide as was the case with the HubSpot CMS.

If in doubt, consult your web developer when it comes to adding URL redirects.

Apply a redirect via the server itself.

The best way to apply redirects from a speed and technical point of view is via the web server itself, rather than relying on WordPress. WordPress does not offer a facility to implement 301 redirects out-the-box, although there are plugins available that will give you access to this functionality.

The process of applying 301 redirects via the server itself will vary depending on the software stack your server is using. You might be using Apache, Nginx, IIS, or some other platform, each of which requires a different approach. This may also vary depending on your hosting provider.

If you do not know how to apply a redirect via the server itself, it's not something we'd recommend fiddling with as it may lead to an interruption of service for your website — instead, we'd suggest consulting with your IT team, host, or web development partner.

Redirect a URL using a free WordPress plugin.

Sometimes in marketing, you must compromise that optimal solution for the solution you can actually achieve. This may be one of those cases. If you are not able to implement a redirect via your server, consider using a WordPress plugin. This is not the optimal method — plugins are slower, and you'll have to rely on third-party code, so proceed at your own risk.

Each plugin interface will be different, so consult your chosen plugin's documentation for specific guidance. Here, we'll briefly walk through how to set up 301 redirects with the free Redirection plugin :

1. Install and activate the Redirection plugin.

the redirection plugin for adding 301 redirects in wordpress

2. Navigate to Settings > Redirection  and follow the setup instructions.

the basic setup menu in the redirection plugin  for adding 301 redirects in wordpress

3. At the end of setup, you'll be taken to the plugin Options menu. To add a new redirect, choose Redirects from the top menu.

the options menu  for adding 301 redirects in wordpress

4. Under Redirects , you can view all of your active 301 redirects and add new ones. To add a new 301 redirect, under Add new redirection insert a Source URL (the old URL) and a Target URL (the new URL).

the add new redirect interface  for adding 301 redirects in wordpress

5. Click  Add Redirect . You'll now see the new redirect in your list of active redirects.

When to Use a 301 Redirect

Here are some specific cases where you will want to reach for the 301 redirect as a tool.

1. Changing a URL.

Maybe your original URL was poorly optimized, or you are re-organizing the folder structure of your website URLs.

Moving a piece of content in HubSpot CMS is very simple — just change the URL on the settings tab of the content's edit page, and HubSpot will automatically add a URL redirect for you. Be sure to check that this is working before you move on.

2. Recreating a piece of content.

Sometimes, you might want to completely rebuild your old piece of content on an entirely new page — for instance, if you decide you want to use a different web page template. 

In this case, you'll want to make sure that you have implemented a simple 301 redirect from the old URL to your new one. Once this is in place, be sure to unpublish and archive the old page.

If doing a lot of these, we suggest using a flexible rule or, if a flexible rule is not appropriate, using a tool such as Screaming Frog SEO Spider in conjunction with Google Sheets or Microsoft Excel to map your redirects in bulk, and then import them into HubSpot.

You can do this on the URL Redirects page using the Import button:

the file upload prompt for bulk 301 redirects in hubspot

3. Consolidating several pieces of content.

If you have decided that you have multiple pieces of content that overlap, compete for the same keywords, or all cover the same topic, you might want to consolidate them . However, you will not want to throw away the search engine visibility that these old pages might have achieved.

Once you have created your new, consolidated resource, you should set up a simple 301 redirect from each of the old pages to the single new page.

4. Migrating content from one domain to another.

If you're moving your website from one domain to another, it is vitally important that you implement page-to-page 301 redirects from your old content to your new content.

This is easy if the site is moving a domain, but remaining the same in terms of structure and layout. If the content is changing or being restructured, it is still important that you make sensible redirection choices that honor your users' original intent, in order to pass the visibility of each of your old pages to their new counterparts.

When implementing page-to-page 301 redirects from one domain to another, you have a specific challenge to keep in mind: your redirects must be served from the original URL.

It is useless if, for instance, you've connected HubSpot to your new domain, but not your old domain, for you to then host the 301 redirects for your old domain onto HubSpot. You will need to work with your IT partner, web development partner, and/or HubSpot partner to ensure that serving redirects from your old domain has been accounted for. We recommend that these remain in place indefinitely.

5. Migrating a Website During a Phased Web Launch

You may be moving your website from one domain to another as outlined above, but due to project constraints, you are using a phased launch approach. This means that you're launching the core website pages in phase one, then a second wave of pages in phase two, and so on.

In this case, we recommend creating a phased redirect map. All URLs from your old domain should be accounted for, and a redirect outlined for each phase.

For phase one, you will expect to implement 301 redirects for all the pages that will be accounted for on the new site. You will also add 302 redirects for all other pages, usually to the new website's homepage. This will prevent users trying to visit your old domain from receiving a 404 error, without confusing search engines by having your pages suddenly redirect to seemingly irrelevant content.

As you launch each phase, you should update your redirects, replacing your 302s with 301s as the counterpart content becomes available.

Once again, these redirects must be implemented such that they are served from your old domain.

The Difference Between a 301 Redirect vs. a 302 Redirect

301 redirects are permanent, whereas 302 redirects are temporary. A 301 is used when a page has permanently changed location, and a 302 should be used if you intend to move the page back under the original URL in the future.

In general, you should expect to use 301 redirects on your website. However, there are a few cases when you might want to use a 302, instead, including:

  • You might be using a phased website launch plan.
  • You might be redirecting users as part of functionality where SEO does not apply, such as login gateways or e-commerce checkouts.
  • You might be using a temporary holding page, and do not want to confuse search engines or damage your search engine rankings by signaling that you're permanently redirecting your detailed, rich content to an empty holding page.

301 Redirect Mistakes to Avoid

Now that you understand the importance of the 301 redirect, we'll review common steps in the process to make sure you don't make a mistake that could adversely impact your site's SEO .

1. Setting up a 302 redirect between versions of your domains.

301 redirects point the power of inbound links from one URL to another, and although it might not look like it,  and  are two different URLs. Make sure you set up a 301 redirect from all of the different iterations of your brand's domain to boost your search engine results.

2. Setting up a 301 redirect after creating a new page.

Back in 2010 , Toys 'R Us purchased the domain without setting up a 301 redirect first, and their new site's SEO results plummeted because it was re-crawled by Google as a brand-new domain without inbound links from the original Toys 'R Us domain pointing to it. Be sure to set up the 301 redirect before migrating your website content so your site doesn't lose traffic in the process.

3. Using a 302 redirect during content migration.

Unless you're temporarily migrating your website's content while updating or repairing your website, use a 301 redirect to maintain the inbound links and your search rankings while making changes to your domain.

4. Having redirects link to outdated content.

If you don't set up redirects from the older internal links on your website (such as a link to your company blog on your homepage), you'll create a bad user experience for site visitors who click on these older, not-directed links. The old internal link will eventually kick over to the new domain, but it might take several seconds or show a white screen in the meantime.

5. Redirect a page with a different intent than the destination page.

This will be a breeze with proper organization and record-keeping, but make sure that you're redirecting to the correct pages. To illustrate, you wouldn't want to redirect a user looking for your homepage to your blog page.

Keeping this transition smooth will contribute to SEO being accurate, and will lead to more happy visitors to your site.

Whether you're thinking about overhauling all content in a site migration, or you're just refurbishing some outdated web pages, 301 redirects help. If you're planning out this new stage, think about incorporating them in your project; your SEO won't take a dive and website visitors will continue to find the helpful content they're looking for.

Other Types of Redirects

There are other types of redirect too, including:

1. 302 - Temporarily Moved

This functions almost identically to a 301 redirect. In this instance, however, we are acknowledging that the move is temporary. For a user, this makes no practical difference, but for a search engine the message is clear — don't worry about ranking this new page, as it won't be around for long. Stick to using the old one, it will be back.

2. Meta Refresh, or Javascript Redirects

This is different from the previous two approaches. The page will load normally with a 200 - OK status code. Then, a script runs on the page that moves the user onto another page.

There may be certain edge cases when this is the only practical option, but in general you should avoid this approach. It is not associated with SEO best practices and often can provide a confusing user experience.

Addressing Internal 404 Errors

Your SEO or web team might have identified some broken links on your website. In this case, it's best practice to create a 301 redirect to forward users from the broken URL through to an appropriate resource — one that is fundamentally congruent with the piece of content they were expecting to find.

However, you should also look to update the offending hyperlinks to point to the new URL, as well. Having a website that relies on 301 redirects for internal navigation is not the best practice.

Addressing 404 Errors Reported in Google Search Console

Sometimes, you will see Google Search Console reporting 404 pages that you don't even link to internally. So where do these come from?

Google Search Console populates its "Coverage" section from all kinds of sources. Sometimes the URLs are simply ones that it has seen before on a previous incarnation of your website, or it might have seen an external link on some other website.

Your mindset should be that if Google has seen this URL before, a user might have as well. They might have it saved as a bookmark, or have it written down in an email, or on a third-party website, and they may still click on it. That being the case, you want to make sure that those users receive the optimum user experience, so you should try to create 301 redirects to push these users to an appropriate piece of content that is fundamentally congruent with the piece of content they were expecting to find.

Don't leave your old links hanging — use a 301.

301 redirects are vitally important for maintaining a healthy website. They serve a core function in signaling to both users and search engines when your website content moves and changes, and ensure that as your web presence evolves, your user journey remains clear and logical, and your visibility in search engines is preserved between iterations.

Be sure to familiarize yourself with implementing redirects in your current website environment. Then, test your website's SEO strength — as well as speed, mobile-friendliness, and security — with our free Website Grader .

Editor's Note: This post was originally published in December 2010 and has been updated for accuracy and comprehensiveness.

Improve your website with effective technical SEO. Start by conducting this  audit.  

Don't forget to share this post!

Related articles.

Duplicate Content Issues on Your Website? Easy Ways to Find and Fix Them

Duplicate Content Issues on Your Website? Easy Ways to Find and Fix Them

The Ultimate Guide to Google Search Console in 2023

The Ultimate Guide to Google Search Console in 2023

Does Google Think Your Website Is Spam?

Does Google Think Your Website Is Spam?

A Beginner's Guide to Data Flow Diagrams

A Beginner's Guide to Data Flow Diagrams

Image Alt Text: What It Is, How to Write It, and Why It Matters to SEO

Image Alt Text: What It Is, How to Write It, and Why It Matters to SEO

The Top 11 Search Engines, Ranked by Popularity

The Top 11 Search Engines, Ranked by Popularity

Parts of a URL: A Short Guide

Parts of a URL: A Short Guide

Sitemaps: What They Are, How to Create One & Submit it to Google

Sitemaps: What They Are, How to Create One & Submit it to Google

The Ultimate Guide to Technical SEO

The Ultimate Guide to Technical SEO

Full List of Meta Tags, Why They Matter for SEO & How to Write Them

Full List of Meta Tags, Why They Matter for SEO & How to Write Them

Grade your website in seconds. Then learn how to improve it for free.

Marketing software that helps you drive revenue, save time and resources, and measure and optimize your investments — all on one easy-to-use platform


Home » Web Tutorials » SEO » 301 Redirects Guide for Beginners

301 Redirects Guide for Beginners

As the name indicates, redirect is a technique to route search engine crawlers and visitors to an available webpage when a requested webpage is not available. There are many ways to setup redirect from a old page to a new page. When redirect is setup, the web server will return a 3xx HTTP status code . During troubleshooting you can find the status code to understand the type of redirect used. In this article, we will explain what is 301 redirects and how to setup redirects for your site to optimize for search engines.

What is 301 Redirect?

Out of all 3xx redirects, “301 – Permanently moved” is the most commonly used redirect by webmasters. In order to avoid 404 not found error it is necessary to setup a 301 redirect whenever the URL of an existing webpage is changed or deleted. This will inform search engines to replace the old URL with the new one and serve the users with the new one whenever requested.

301 is the HTTP status code returned by a web server when the requested URL by the client is reached by redirecting the user agent. The user agent is normally a web browser or a search engine crawler trying to access a web page. 301 status code is not shown in the browser window and the user agent is automatically redirected to another resource by the server. Hence, it is generally called server side 301 redirect setup.

The pictorial representation of 301 redirect is shown in the below picture:

301 Redirect Setup

How to Check 301 Status Code?

If you want to test your 301 redirect then the simple way is to open the old URL in the browser window. You should be automatically redirected to your new URL if you setup the redirect correctly. You can also use “ Fetch as Google ” or “ Fetch as Yandex ” tool available in the webmaster tools account to check 301 status code is received from the server for the old URL.

Why do You need 301 Redirect?

301 redirect is a useful tool for diverting users from your old URL to your new URL. This may be required in one of the following situations:

  • To avoid 404 not found error in situations like change in the existing page URL,  an old webpage is deleted or m erging two sites.
  • Canonical URLs to use  www or non-www version.
  • Transferring domain from one service provider to another.

In all the cases setting up of 301 redirect is an important task in order to avoid losing the hard-earned traffic to your site.

1. To Avoid 404 Not Found Error

When you build a large site with hundreds of pages, it is a common mistake that some of the pages may not linked appropriately. Sometimes it is also possible that an external link in your site becomes invalid due to non-availability of that page. Both cases will result in a broken link and when clicked on a broken link the server will respond with an HTTP code  “404 – Page Not Found”. Page not found is a common message when the URL of a webpage is changed and the old link has not been redirected to the new page.

Search engines count these 404 errors as a problem in your site since it can’t offer a requested resource to the users. For example, Google Search Console  shows all 404 error messages in your site’s dashboard as a crawl errors. You will also lose your ad revenue in case if you placed any ads on the pages not available to search engines.

Standard Weebly 404 Page

It is also possible that user entered a wrong URL or use to access some sub-directory which does not exist. The simple way to get advantage over 404 error is to create your own “404 – Not Found” page and provide useful information like search box and important links in your site. This will help users to search or navigate through your site and get the required information.

2. Redirect between www and non-www Versions

One of the important need of setting up a redirect is to direct all your traffic to one source, that is www or non-www version of your site. For example:

  • You registered a domain name and did not set any preferred domain in Google webmaster tools account.
  • Google treats and as a two different sites and considers the links for each site separately.

This will really affect your SEO ranking of your site since the link count will be reduced for any version of your site. For a new site, set your preferred domain as either https:// or https://www in webmaster tools account, submit Sitemap of that version and ensure Google indexes all your pages of that version. In case if you have a running site with split of inbound links then set a redirect of one version to another version of your site.

3. Domain Change and Transfer

Setting a redirect is required whenever there is a change in a site name or changing service providers. For example:

  • Initially you may start building your site as a free site with a name like and later want to change it to
  • You started building a HTML site and later decided to go for PHP service provider.

If you have different version of your site for desktop and mobile then it is essential to setup a mobile redirect in your desktop site so that when users opening your site in a mobile devices will be redirected to your mobile pages.

How to Setup 301 Redirect in Various Platforms?

It depends on the hosting service provider and the type of website you are using. For example, Weebly provides a simple way to setup redirects  without changing any root directories if the old and new domains are same. On platforms like WordPress, you can use plugins to setup redirects with ease. Otherwise you may need to follow any one of the methods listed below for  setting up 301 redirects .

All the below examples indicate setting a redirect in an old page in order to redirect to a new page within the same domain. If your domain name is changed then replace the domain name with your new domain. Generally redirection is done at server side by configuring Apache or IIS servers to ensure the server returns 301 HTTP status codes for search engines. This is done using PHP, ASP or ASP.NET scripts. Client side redirects using HTML meta refresh or JavaScript are not recommended since these methods will not return 301 code.

Server Side 301 Redirect

Save this change in your old php page.

In PHP redirect, the old page should be with .php extension and the new page can be with any extension. If you want to use PHP redirect with an existing HTML page then enable the following line in your .htaccess or httpd.conf file.

Save this in your old asp page.

Save this in your oldpage.aspx.

.htaccess Redirect for Apache Server

In order to set 301 redirects in an Apache server you should have access to the configuration file called .htaccess. Both single page redirect as well as domain level redirect can be set using .htaccess file.

Redirecting old page to a new page:

In order to redirect all pages of an old domain to a new domain configure .htaccess file of an old domain as follows:

Redirecting Canonical Sites Using .htaccess and are considered as a two different sites by search engines and hence it is recommended to choose a preferred domain settings in your webmaster tools account. You also can redirect all traffic to a site with www by modifying .htaccess file with the following code:

301 Redirect for IIS

  • Choose the file in the Internet Services Manager for which redirection is to be set.
  • Right click and choose redirection to a URL.
  • Enter the new file name for redirection.
  • Choose “The exact URL entered above”.
  • Select “A permanent redirection for this resource”.
  • Click Apply.

Client Side 301 Redirect

Html meta refresh.

Though HTML meta refresh does return a 301 HTTP status code this is considered as a 301 redirect by search engines like Google. Replace the old code of your HTML page with the below code in order to redirect to a new page.

JavaScript Redirect

Add the following code in your old page to redirect to a new page. Like HTML meta refresh, JavaScript redirect also will not return 301 code.

jQuery Redirect

This is another type of redirect without returning 301 code, add the below code in your old page:

What is an Infinite Loop?

Generally a web server can redirect the user agent up to five times to fetch the requested resource and redirecting more than five times will result in endless loop called infinite loop. In this case the user agent may try to fetch the resource without any result.

Infinite Redirect Loop

Infinite loop also will occur by not setting up the 301 redirect appropriately. For example, when two pages “” and “” are pointing to the same home page of the site then setting up 301 redirect of any one URL to others will end up in an infinite loop.

About Editorial Staff

Editorial Staff at WebNots are team of experts who love to build websites, find tech hacks and share the learning with community.

You also might be interested in

Search Engine Optimization for Mobile Sites

Search Engine Optimization for Mobile Site

As the world moves towards mobility, optimizing your website for[...]

Fix Not a Valid JSON Response Error in WordPress

How to Fix Updating Failed The Response is Not a Valid JSON Response Error in WordPress?

Earlier WordPress was using plain classic editor interface which was[...]

Fix Update Failed Errors in WordPress

How to Fix Update Failed Errors in WordPress?

In software world, applications need continuous update to protect against[...]


  • SEO Guide for Beginners
  • WordPress SEO PDF Guide
  • Weebly SEO PDF Guide
  • Alt Code Emoji Shortcuts PDF
  • ALT Code Shortcuts PDF
  • View All eBooks


  • ALT Code Shortcuts for Symbols
  • Fix Chrome Resolving Host Problem
  • Fix Slow Page Loading Issue in Google Chrome
  • View Webpage Source CSS and HTML in Google Chrome
  • Fix Safari Slow Loading Pages in macOS
  • Fix Windows WiFi Connection Issue
  • ROYGBIV or VIBGYOR Rainbow Color Codes
  • Fix I’m Not A Robot reCAPTCHA Issue in Google Search
  • Structure of HTTP Request and Response


  • Move WordPress Localhost Site to Live Server
  • Move Live WordPress Site to Localhost
  • Move WordPress Media Folder to Subdomain
  • Fix WooCommerce Ajax Loading Issue
  • Create a Free Weebly Blog
  • Edit Weebly Source Code HTML and CSS
  • Add Scroll To Top Button in Weebly
  • Add Table in Weebly Site
  • How to Add Advanced Data Table Widget in Weebly?
  • Up to $500 Free Google Ads Coupon Codes


  • Webpage Source Code Viewer
  • HTTP Header Checker
  • What is My IP Address?
  • Google Cache Checker
  • Domain Age Checker Tool
  • View All Free Web and SEO Tools

© 2024 · WebNots · All Rights Reserved.

Type and press Enter to search

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Safari settings for redirects

I run a website which uses a re-direct. Safari does not seem to want to go to this website, although it is a harmless one - and is a parish magazine here in Yorkshire, UK. Can anyone tell me how to adjust the Safari settings to allow it to go to the website that this connects to? I know that, on Google Chrome, I change the settings on "pop-ups and redirects", but I do not have knowledge of Apple devices. I need to be able to tell other users how to adjust their Apple devices, though.

Many thanks,


iPad Pro 12.9-inch, 3rd Gen, Wi-Fi, Cell

Posted on May 3, 2020 12:55 AM


Posted on May 3, 2020 4:48 AM

It would be better to address the underlying problem.

If you're able to replace index.html (or equivalent) on the server that's initiating the redirect, the following PHP will do a 301 redirect which is much nicer than the meta refresh you're using now:

Save this line in a plain text file called index.php and pop it on the server in the same directory as index.html, then rename index.html to something like old.html so that the server no longer defaults to it but you can restore it if the PHP doesn't work.

Similar questions

  • Frustration with Safari I've used Safari for quite awhile believing it is more secure; lately, though, I find many issues that force me to turn to Firefox. Sometimes when placing an order online, the "place order" link doesn't work. The same URL on Firefox does work, so I suspect it isn't the website. I am not using using extensions on Safari. OS is 12.3.1 (Monterey), I frequently clear the cache. Is it just me? 416 1
  • Safari Redirection to Advertising Sites When visiting a site using Safari I constantly get hijacked to another site. I've reinstalled the OS, followed any and all instructions I could find online to no avail. Does anyone have a solution? 126 1
  • Excessive safari redirects I need to clear safari redirects. How can I do it in language a mid seventies non computer person can understand. RichRYan 6066 2

Loading page content

Page content loaded

May 3, 2020 4:48 AM in response to PhotographerJames

May 3, 2020 11:33 PM in response to medwds

Thank you very much for your suggestion, I will try this and see how it goes. Appreciate you taking the time to help an old duffer!

Keep safe and well.

Chad Schulz

Principal SDE Manager at Microsoft. Currently working on

301 Redirects and Reversing a 301 Redirect

On large sites there’s often a need to redirect pages that move, have rebranded content, or become deprecated over time. Along with maintaining the “search equity” of a page, it’s also important to keep the site usable and coherent for users. This can be challenging to configure and maintain, and even more challenging if a 301 redirect needs to be reversed.

Redirect setup

  • Search equity : the “link juice” or how much SEO weight a specific page carries.
  • 301 redirect : a “permanent” redirect that will also transfer search equity.
  • 302 redirect : a “temporary” redirect that will not transfer search equity.

When a page, or URL, is no longer needed on a site there are a few paths to take. The ideal scenario would be to add a 301 redirect from the deleted page to a new page that is a content-equivalent of the removed page. For example, if the content on page /foo/ is being moved to /bar/ , a 301 redirect would be appropriate.

If a page is truly removed, without a replacement, let it 404. Letting search engines and users know that a page no longer exists can be beneficial. Search equity will be forfeited, so investigate if a replacement exists first, but do not redirect to an unrelated page as search engines will penalize ranking if this practice is detected.

Redirect tldr;

  • When a page moves, add a 301 redirect to maintain the search equity.
  • Do not add 301 redirects for unrelated content pages, search engines will penalize for this behavior.
  • A 302 redirect does not maintain search equity.
  • A 404 is not a bad thing, especially if there is no content-equivalent to redirect to.

Browser caching of 301 redirects

Browsers cache assets ranging from CSS to images to redirects, all in the interest of loading sites faster for users. If a browser encounters a 301 redirect it will cache the server response so that, if requested again, the browser can serve up the destination straightaway rather than reaching out to the server for the redirect. This standard behavior is demonstrated with Firefox:

Firefox network tab showing 301 redirect from /foo/ to /bar/ is loaded from disc cache

Subsequent loads of the same URL will load the 301 redirect from cache, rather than contacting the server, as demonstrated by Microsoft Edge:

Google Chrome network tab showing 301 redirect from /foo/ to /bar/ is loaded from disc cache

Great! The internet is fast and browsers are being smart by not doing repetitive tasks. However, let’s say the 301 we established was incorrect, and so incorrect it needed to be reversed ( /foo/ --> /bar/ to /bar/ --> /foo/ ).

301 Redirect Reversal

In general, it seems to be the case that when a browser loads it’s cached 301 redirect only to find it’s actually a 301 back to the source, it breaks the infinite loop and goes back to the server to revalidate the requests.

For Edge, Chrome, and Opera the 301 redirect reversal takes effect immediately and the browsers’ local cache was reset.

Google Chrome network tab showing 301 redirect from /bar/ to /foo/ is loaded from server

In Firefox, however, the 301 redirect and destination HTML were cached.

Firefox network tab showing 301 redirect from /foo/ to /bar/ is loaded from disc cache, and destination /bar/ HTML is loaded from cache

When it came time to reverse the 301 redirect, Firefox continued to load the 301 redirect and the destination HTML from cache, rather than reaching out to the server. Opening a new tab and restarting the browser were not enough to invalidate the cache, only explicitly clearing the cache was enough to force the 301 redirect reversal.

Firefox network tab showing destination /bar/ HTML is loaded from disc cache

There’s still hope! With modified cache-control headers, it’s possible to tell Firefox to reevaluate the cache. One such option is cache-control: no-cache which tells the browser the asset can be cached, but the server “must revalidate each time before using it.” This behavior is exactly what’s needed to force Firefox to reevaluate the cache and allows a 301 redirect reversal to work.

  • Free hosting
  • Shared hosting
  • LiteSpeed hosting
  • Semidedicated hosting
  • Reseller hosting
  • LiteSpeed reseller hosting
  • UnManaged VPS cloud
  • Managed VPS Cloud
  • Dedicated servers
  • SSL certificates
  • Domain registration
  • Change hosting
  • Why SupportHost
  • Client area
  • Request support
  • Password reset

301 redirect: the definitive guide

In this article, 301 redirect: the definitive guide, we will see what 301redirects are used for and find out why they are crucial for SEO.

Basically, 301 redirects allow you to redirect users from one page to another. The most obvious case where you may need them is when you change your site address, but that's not the only instance where redirects are useful.

Let’s find out when they are needed and how to implement them, also by analyzing what happens when 301 redirects are not set up or are used incorrectly.

Let's start from the beginning and see what 301 redirects are.

Table of Contents

301 redirect: the definitive guide - what is 301 Redirect?

It is possible to use redirects within a site to get users from one page to another. A 301 redirect is a permanent redirection, meaning that it represents a resource or page that has been moved permanently.

Redirects are therefore a way to communicate to users and search engines that a page (or even an entire internet domain) has changed address.

For example redirecting to

But why 301 redirects? This kind of redirect communicates a permanent shift to make a distinction between other types of redirects (such as redirect 302) that can be used, however, in the event that the shift occurs temporarily.

What changes between a temporary and a permanent move?

The user who is trying to visit that page does not perceive any difference. In both cases, he/she is simply redirected from one page to another and reaches the content he/she was looking for.

For search engine spiders this difference, instead, is fundamental. With a 301 redirect, we want to communicate to search engines that they don't have to consider the old address anymore and that the content has been moved to a new address.

As we will see later when we look at redirect 301 and SEO, the use of this kind of redirects is fundamental to maintain the positioning.

When do you need a 301 redirect?

301 redirects can be used if you decide to make changes to your site structure, change domains, or even move some of your site resources. Let's take a look at these different cases.

Site changes

One of the most common situations where you may need to implement a 301 redirect is if you change your domain. You could choose to change the domain if you want to change the extension from a .it domain to a .com domain.

Or you might find yourself at a turning point and decide to do a proper company rebranding with a new name.

In other cases, you might want to make changes to the structure of the site, for example moving part of the content from a subdomain to a subfolder. Moving from a structure:

to one like this

Or you could decide to move from the version without www to the one with www (or vice versa). In all these cases 301 redirects will allow you not to have problems with duplicate content and to direct users to the new version of the site.

Moving or deleting pages

301 redirects come to your aid not only when you decide to make changes that affect the entire domain, but also on a daily basis.

You may want to delete some content or pages of your site. In this case, the first question to ask yourself is why you are deleting that content.

Usually, you might want to delete blog posts or site pages to create new ones. In these cases, if you are going to create new content similar to what you want to delete, the best thing to do is to use a 301 redirect.

Redirect 301 Error 404

By doing this you don't risk that the user trying to reach the content through the old address will end up on an error page. Typically an error 404 for content not found, if instead you set a 301 redirect the user who wants to reach that content will come directly to the updated content you created.

The same goes for search engine spiders. When the bots scan the pages and come to an error page they abandon the crawl. If, however, there is a redirect they land on the new page and are able to scan its content.

Switching from http to https

Currently, over 72% of websites use the https protocol . Those who switch from http to https must also set up a 301 redirect to direct visitors (and search engines) to the site with a secure connection.

Redirect 301 vs redirect 302

There are two most common types of redirects: the 301 redirect and the 302 redirect. As I mentioned before, these two types of redirects are considered differently by search engines.

In a nutshell, a 301 redirect is used for a permanent move, while a 302 redirect is used for the temporary move of a page. But what does this mean?

If search engines are faced with a 301 redirect they understand that the content has been moved permanently. This means that it no longer makes sense to index the old URLs, but that it is time to start indexing the new ones, i.e. the addresses that have been chosen as the destination of the redirect.

301 redirects vs JavaScript redirects

You can use JavaScript redirects as a last resort if, you have no way of accessing the site's server. Remember that among the best practices ssuggested by Google, 301 redirects are always to be preferred and, unlike JavaScript redirects, 301 redirects allow you to transfer link juice to the destination pages.

Removing 301 redirects

301 redirects are permanent, but does that mean we have to keep them forever after we delete or move previous content?

A few years ago a response from John Mueller of Google clearly answered this question.

301 is permanent, it means forever and that's a mighty long time, but I'm here to tell you, there's something else: the server maintenance. After a few years the old URLs are often no longer accessed & you can drop those redirects. — 🍌 John 🍌 (@JohnMu) January 18, 2019

To avoid problems, the best solution is to maintain 301 redirects for at least a year. After this period it is probably better to make sure that you do not receive any more traffic from these addresses before you can remove them.

Redirect 301 and SEO

One of the factors that affect the positioning of a site is the PageRank. If in the past, using 301 redirects (or even 302 redirects) involved a small loss of PageRank (a loss that was around 15%), now it is no longer so.

We can find a confirmation in the FAQ dedicated to the switch from http to https, where Google assures that no PageRank penalty is applied by using redirects. This about-face in Google's policies is largely due to encourage the adoption of secure connections with the https protocol.

301 Redirects Search Engines

At the same time, we must not forget how important the relevance of the content of pages subject to redirects is.

We have to keep in mind that Google doesn't like redirects to home pages or to pages that don't contain identical content (or at least similar) to the starting one. In these cases, if the 301 redirect is not considered valid or relevant, Google might consider it as a soft 404 error.

In order to keep the advantages in terms of SEO and not to lose positions, it is therefore important to pay attention to the destination links of our redirects.

Advantages and risks of 301 redirects

Let's summarize the benefits of using this kind of permanent redirects and what to pay attention to in order to get the most out of your site.

301 redirects and users

301 redirects improve your credibility and allow users to reach your site.

Imagine that a user wants to visit your site, knowing the address already he/she types it in the address bar and expects to arrive at their destination.

In the meantime, however, your site has changed domain, let's say that you have just moved from a .it domain to a .com or you have changed the name of your domain.

There are two possible scenarios.

In the first one, you have implemented 301redirects from the old domain to the new one: the visitor is redirected to the new site and everything goes as it should.

In the second one you haven't used 301 redirects : the user is faced with a non-existent page, a 404 error warns him that that page doesn't exist anymore. The result is that you lose traffic and in most cases, this also translates into a loss of revenue.

301 redirects and search engines

301 redirects let search engines know that you've moved content around.

Let's consider a case similar to the previous one: you have changed the domain and now your content is on a new site.

In this case, however, let's analyze what happens from the point of view of search engines.

301 Redirect Website Authority

If you don't use redirects, search engines will continue to show the old URLs with which you are positioned. Gradually though those pages will start to lose positions because they don't really exist anymore and lead to 404 errors.

Search engines aim to lead users to what they are looking for and not to error pages. If you don't redirect old content to new content you will invariably lose all the work required to position yourself.

On the contrary, with 301 redirects the page authority of the old addresses is transmitted to the new ones.

Redirect 301 and duplicate content

With 301 redirects you eliminate the problem of duplicate content.

As a site expands it can sometimes happen to see the accumulation of similar content, different pages with similar information or posts from your blog. If two pages are considered duplicate content, Google will choose only one version to show in the search results.

If you have pages that are very similar to each other consider funneling the content into one page and thus create a more complete resource. After merging the content into only one of the two pages delete the other. At this point use, a 301 redirect to redirect traffic from the deleted page to the full page.

This method also helps you eliminate keyword cannibalization issues. If two pages on your site are trying to rank for the same keyword combining the two pages can help you create more complete content that performs better in terms of traffic.

Redirect 301 and outbound links

Redirects are a double-edged sword.

You have to consider that redirects are useful, but that sometimes they could be exploited even by those who do not have good intentions . It is likely that your site has links to resources on other domains and what if those resources were moved?

In the best-case scenario, if you link to a page or a site that no longer exists, users will find themselves in front of a non-existent page. But what if they are on a completely different site?

When a domain expires it becomes available for registration again. This means that potentially anyone can register it and use it to create their own site. This prompts some people to register expired domains to grab backlinks and thus attract traffic to the site.

It's a good idea to monitor links pointing to other domains to make sure there are no redirects pointing to content other than what you wanted to direct your users to.

Chains of redirects

Be careful of redirect chains.

If a page links to a series of redirects, before reaching the destination page, you create what is called a chain of redirects.

The reason is that over the years, migrations and changes in site structure can occur. The problem is that these chains sometimes become an endless loop that prevents users (and search engines) from reaching the landing page.

In this case to break the redirect chains you just need to remove the oldest redirects and thus shorten the chain.

If you don't do this, you risk that the response time to reach the destination page will be too long and the browser will return an err_too_many_redirects error without being able to reach the page.

To check that there are not too many redirects there are several tools we can use.

Detect redirect chains

The online tool httpstatus allows us to enter addresses (up to 100 URLs at once) and check for redirect chains.

Redirect 301 Chains Of Redirect

SEO Spider by Screaming Frog (also in the free version) can be used to detect redirect chains. Remember, though, that in the free version you can scan up to a maximum of 500 URLs at once.

After completing the scan we will have all our site pages with their http status code (200, 301, etc). If we click on the menu at the top Reports → Redirects → Redirect Chains we can download a csv file with the chains of redirects detected.

Screaming Frog Redirects Report

In this way, we can easily identify the chains and the number of redirects there are between an address and the destination.

Screaming Frog Redirect 301 Report

Redirect and sitemap

Do not include pages with redirects in the sitemap.

Before submitting the sitemap of the site to the search engines you must make sure that the pages have a 200 http status code, i.e. that there are no errors.

This is also valid for redirects, a good rule is to make sure to remove from the sitemap the pages with 301 status code, that is those that are redirected to other pages.

On the other hand, if the sitemap already contains the new URL to which the page redirects, it doesn't make sense to ask the bots to scan also the pages that redirect to others already present in the sitemap.

How to implement redirect 301

There are different methods to implement a 301 redirect. The most commonly used method is to insert a rule in the .htaccess file of the site.

This method is only valid on Apache servers.

To edit the .htaccess file you can access the root of the site from an FTP client (like Filezilla ) or use the cPanel file manager .

The code you have to insert depends on the kind of 301 redirect you have to do: moving a single page, redirecting from the old domain to the new one, switching from http to https are some of the most common examples. Let's see how to do it from one case to another.

I remind you that before modifying the .htaccess file is always good to create a backup copy so you can restore it in case of errors.

How to make a 301 redirect of a page

If you want to redirect a single page to another you just need to insert this line in the .htaccess file:

Going to replace the old and new addresses respectively.

The code must be inserted after <IfModule mod_rewrite.c> and before </IfModule> .

Do a redirect from the old to the new domain

Insert this code in the .htaccess file of the old site when you change domain and want to redirect to the new site.

In this case, you will have to replace the addresses with the ones corresponding to your old and new sites.

Redirect da dominio www a non www o viceversa

Anche se il tuo sito è accessibile da entrambe le versioni (con www e senza) è meglio stabilire una delle due come versione predefinita.

Per questo potresti dover impostare un redirect 301 dalla versione con www a quella senza o viceversa.

Redirect from non-www to www

Redirect from www to non-www, redirect from http to https.

Always insert immediately after RewriteEngine On .

Redirect 301 with PHP

You can set a permanent redirect using PHP header function, like this:

You will have to insert the new address instead of Alternatively, you can also use a single code line, remembering to specify the 301 status code, since this is a permanent redirect:

Redirect with cPanel

In addition to editing the .htaccess file, you can also do a 301 redirect with cPanel. cPanel is one of the most widely used hosting management panels and is the one we provide to users who choose one of our plans from WordPress hosting to VPS cloud hosting and dedicated servers .

Adding a redirect with cPanel will automatically create a rule in the .htaccess file.

To add a redirect we simply log in to cPanel and scroll down to the Domains section and click on Redirects .

Cpanel Redirect 301

From this point, we choose the type of redirect (301 permanent or 302 temporary). We select the domain we want to redirect.

If we want to redirect a single page, we just complete the path by entering it in the / field as you see shown here:

Cpanel Add Redirect 301

We then enter the destination URL in Redirect to and finally click on Add .

Be careful because in this case the redirect rule is added at the end of the .htaccess file. If you are using WordPress or another CMS this rule might get ignored and the redirect will not work.

After creating a redirect with cPanel you will not be able to edit it. If you want to make changes you will have to delete the previous redirect and create a new one.

To delete a redirect, simply go to Domains → Redirects and scroll down the page until you locate the redirects you have set up. After that click on Delete from the Action menu.

Cpanel Delete Redirect 301

Redirect 301 with WordPress

To make a redirect with WordPress you can use a plugin e semplificarti la vita.

Set up redirects with the Redirection plugin

Redirection is a free plugin designed specifically to simplify redirects on your WordPress site. First, let's install and activate the plugin.

Login to WordPress and click on Plugins → Add New. Let's look for the plugin we are interested in, install and activate it.

Install Redirections Plugin

By starting the configuration we are asked if we want to track changes to permalinks and if we want to record a log of redirects and 404 errors.

Redirection Configuration

Let's complete the configuration and we are ready to use the plugin.

In the Tools section of WordPress, you will now see a new entry: Redirection.

Tools Redirection

From this section, we can set the redirections by simply entering the old URL in the source URL field and the new one in the target URL as you see in this example.

Redirection Plugin Add Redirect 301

By clicking on the little gear icon next to the Add a redirect button, we can set the type of redirect. If you want to set a permanent redirect just choose the 301 option.

Redirect 301 With Redirection

After checking that the addresses are correct click on Add a redirect to add the redirect.

The redirects added will be visible in the box at the top which will also allow you to see the number of visits to the page. This way you can get an idea of how much traffic you are getting from the old URLs.

Redirection Plugin Redirect 301

Set up redirects with Rank Math SEO

If you are using Rank Math SEO as a plugin to get tricks for optimizing your articles, I have great news for you. This plugin also integrates a feature to easily manage redirects. Let's see how it works.

First, if you haven't already done so, install and activate the plugin.

Install Rank Math

After activating it follow the wizard and you are ready to use Rank Math SEO. Let's see what options it gives us for managing redirects.

Set redirects

Let's make sure that the Redirections module is active from the plugin's bulletin board to the Modules section.

Rank Math Seo Redirect 301

After activating it the Redirections option will appear in the side menu (Rank Math → Redirections).

Rank Math Redirection

To add a new redirection we just need to click on the Add new button that we see at the top.

Rank Math Add New Redirect 301

We can then redirect one page of the site to another simply by filling in the following fields:

Rank Math Add Redirect 301

Source URLs : here you have to insert the source URL (the old article or the old page).

Destination URL : here you have to insert the destination address.

Redirection Type : we can choose between 301 redirect (permanent) or temporary redirect (302 or 307).

In the end, we click on Add Redirection .

In most cases, we won't have to change any options. If, on the other hand, we want to redirect several pages to one destination we can do it without having to set the redirects one by one.

By clicking on the Add another button in the Source URLs field we can add other fields in which to insert the other addresses.

Rank Math Multiple Redirections

Also, when we delete an article, a page or even an element of the taxonomy (tag or category) Rank Math reminds us that we can set a redirect with a warning like this:

Rank Math Redirect 301 Seo Notice

By clicking on the a new URL we can set the destination address and choose the type of redirect.

Match types

Next to the field where we go to enter the source address (Source URLs) we also see a drop-down menu that by default is on Exact .

Rank Math Select Redirect 301 Type

This is the type of match that the redirect will be valid for. Usually, the redirects we want to set up are an exact match.

This happens when we want users visiting the page to arrive at the page. In this case, users will only be redirected to the new page if they type in the full address we set as the source.

Rank Math also allows us to redirect all URLs that contain a certain string. In this case, we'll just specify in the Source URL field the text string (and not the full address) and then choose from the dropdown menu Contains in this way:

Rank Math Add New Redirect

In this case, all URLs that contain that word anywhere in the address will be redirected. For example:

By choosing Start With as match type we can choose to redirect URLs that start with a specific word. In this case, only addresses that have the specified word at the beginning of the URL will be redirected. In the example above, would be redirected while and would not.

In the same way, by choosing End With as a match type we can redirect all URLs ending with a certain word.

In our example, only will get a match and will be redirected.

Manage site redirects

Clicking on Rank Math → Redirections we can have an overview of all the redirections we have set on the site.

The From column shows us the starting URLs, the To column the destination addresses. In Type , we can see the type of redirection.

Rank Math Redirection List

The Hits value shows us the number of times the old link has been visited, while in Last Accessed we see the date of the last access to that address.

From this screen, we can also edit, disable or delete redirects.

In this article: 301 redirect: the definitive guide, we've seen what 301 redirects are for and their relevance for users visiting your site and for search engines. There are a variety of situations where you need to set up a redirect and also different ways to do it. We have seen how to do it by putting a rule in the .htaccess file and how to make things easier and manage redirects directly with WordPress.

Have you ever found yourself using 301 redirects? What method did you use to implement them? Let me know in the comments below.

author image

Ivan Messina

Search the blog, popular articles.

  • How to choose a web host
  • Dedicated server price
  • Cloud server hosting price: how much is it?
  • How to transfer to
  • Cloud hosting vs shared hosting: differences

Best sellers

  • WordPress hosting
  • WooCommerce hosting

Try our shared hosting for 14 days for free and without obligation. If you're happy with it, you can upgrade to a paid plan without losing the work you've done!

Related posts

Wordpress Change Domain

WordPress change domain: definitive guide

Link Juice

Link juice: what is it and its SEO importance

Http To Https

How to change from http to https

Leave a reply cancel reply.

Your email address will not be published. Required fields are marked *

By adding my comment I declare that I have read the privacy policy and give my consent to the processing of data.

This site uses Akismet to reduce spam. Learn how your comment data is processed .

Privacy Overview

Create your address on the web.

  • Domain Check

Move your domain name to IONOS.

  • Free Domain

Secure site traffic and build trust.

Create your own website easily.

Our experts build your website.

Create your own online store.

Fast, scalable hosting for any website.

Optimized for speed, reliablity and control.

Reach out with your own email address.

Secure and share your data on the go.

Powerful Exchange email and Microsoft's trusted productivity suite.

Pay as you go with your own scalable private server.

  • Virtual Private Servers (VPS)

Get enterprise hardware with unlimited traffic

Individually configurable, highly scalable IaaS cloud

  • Business Name Generator
  • Logo Creator
  • Favicon Generator
  • Whois Lookup
  • Website Checker
  • SSL Checker
  • IP Address Check
  • Web development

What are 301 Redirects?

What are 301 Redirects?

A 301 redirect is a permanent redirect of a web address to a different one. In this article, we’ll explain the technical background and show you how you can set up a 301 redirect using htaccess.

  • 301 redirects for content migration
  • 301 redirects for search engine optimisation
  • Setting redirect 301 with htaccess
  • Simple 301 redirects in the htaccess file
  • Complex 301 redirects in the htaccess file
  • Damaging the htaccess file during manual editing
  • Chained redirects and redirect loops
  • Possible cache poisoning when using 301 redirects

Why are 301 redirects needed? ¶

The 301 redirect is the best-known type of redirection. The number 301 is based on the HTTP status code. While the status code 404 shows that the requested resource can’t be found, 300 codes stand for redirects. Generally, you use a 301 redirect to avoid 404 errors.

Here’s an overview of the most important HTTP status codes :

301 redirects for content migration ¶

To locate content, or resources, on the web, web addresses are used. When content migration occurs, the address where the content can be found changes. The content itself, however, does not. This is often the case when switching from HTTP to HTTPS or when moving a site from one domain to another. An address may also change when optimising the link structure for search engines. In all these cases, you don’t want users who are trying to access the content with the old address to land on an empty page.

If a server can’t find a resource at a given address, it will return a HTTP 404 Not Found error . This type of error tends to annoy users since they aren’t able to access the webpage they want to. If the address is opened by a web crawler instead of a person, 404 errors can lead to the de-indexing of that resource. Website operators try to avoid both instances as best they can.

301 redirects for search engine optimisation ¶

Apart from changing the addresses of web content, 301 redirects are also an essential part of search engine optimisation (SEO) and online marketing . 301 redirects are used to create search-friendly URLs and canonical URLs. URL shorteners are often used on social media and are also derived from 301 redirects.

Why are 301 redirects so important for SEO? Unlike 302, 303 and 307 redirects, with a 301 redirect the ‘link juice’ of the original address is transferred to the new one. If a search engine has indexed this content and rated it positively, the address won’t lose its rating when replaced with the 301 redirect. 301 redirects also make complex SEO strategies such as multiple domain strategy possible.

How do 301 redirects work? ¶

301 redirects come into use during exchanges between web servers and clients . The server tells the client that the requested resource is no longer available at the given web address (URL) and provides it with the new valid address. Both a person’s browser as well as a search engine bot can be considered clients.

  • The client attempts to access the resource at the URL.
  • The server answers with the status code ‘301 moved permanently’ and gives the new URL as a HTTP location header.
  • The client saves the new URL in its cache, meaning any further attempts to access the old URL will automatically direct to the new one.
  • The client then attempts to access the resource from the new URL.

This process can be seen using the popular cURL network tool . You can open the IONOS homepage, , and use the option –head, to display the HTTP response header:

The IONOS server answers with the HTTP-Status-Code ‘301 Moved Permanently’ and the location header contains the new address . As you can see, the homepage is under the www subdomain and uses the HTTPS protocol. Next, you can tell cURL to follow the 301 redirect using the option –location .

cURL will now show the header for two connections. The second one answers the server with the status code ‘200 OK’ . The resource was found, and the content is shared in the response body. The same process occurs in the background of your browser when you enter an address in there.

Setting redirect 301 with htaccess ¶

We’ve already taken a look at how 301 redirects work between clients and servers. But how do you set up 301 redirects on a server ? There are different methods to do this but one of the most common ways is to set up a redirect in the htaccess file of the Apache web server. In order for this to work, the corresponding Apache module needs to be open:

Simple 301 redirects in the htaccess file ¶

Let’s take a look at how simple 301 redirects can be set up in the htaccess file. To do this, use the redirect directive from the mod_alias module. These are suitable when you want to redirect a URL on the server to another URL . The template is as follows:

Next, redirect the URL on the server to another internal URL . The forward slash at the beginning indicates the start of the URL path, which is the part that comes after the domain:

To send it to an external URL instead , add the external URL as the target:

Using the redirect directive, you can also define 301 redirects for entire indexes in the htaccess file. In this example, we’ll redirect all URLs with the ‘de’ path component to a subdomain.

Similarly, we can redirect all the URLs on a domain to a new domain :

If you want to redirect individual addresses that have a similar pattern, you can use the RedirectMatch directive. This way you don’t have to note the redirects individually. The directive uses a standard expression to recognise patterns and extract from them.

Here we’ll show you a RedirectMatch entry which extracts the category and ID of an article from the GET parameters and then redirects them to the path.

Imagine our domain is . The URL would be redirected to .

Complex 301 redirects in the htaccess file ¶

To create a 301 redirect for advanced redirects you can use the rewrite directive from the Apache rewrite module mod_rewrite . This allows you to define and request redirect conditions, set and read environmental variables, and define redirect rules with regular terms.

With mod_rewrite , it’s possible to chain redirect rules. The module will deliver something similar to a mini-programming language to reform URLs and carry out redirects . However, this is something you must be careful with, because if you use it incorrectly, you can cause infinite loops.

The rewrite directive begins with the target ‘RewriteEngine on’ followed by the optional RewriteCond conditions. After that comes one or more multiple RewriteRule redirect rule(s). How the rewrite conditions and rules work can be changed using Flags, which are essentially different options . To set up a 301 redirect, a rule must contain the flag L,R=301 :

Within the redirect rules and conditions, you can access multiple header and server variables from the form %{HTTP_HOST}, %{REQUEST_URI} etc. These can be linked by operators and edited as functions. This means almost all desired redirects can be carried out, even if the syntax isn’t exactly intuitive.

Let’s have a look at an example of a 301 redirect using the mod_rewrite . We want to force canonical URLs to avoid duplicate content on our website. This means that all URLs begin with HTTPS and www., regardless of how users open the content.

We can define two redirect conditions, which can be linked using the OR flag. The first condition checks whether HTTPS is off, and the second condition checks whether the domain is missing the prefix ‘www.’ With the NC flag, we can switch off the difference between uppercase and lowercase letters. If one of the conditions is true, we redirect it to the https-www. Version of the URL . To do this, we use the common phrase (.*), which all URLs access. To enter it behind the domain, use $1:

What are the problems and risks associated with using 301 redirects? ¶

A 301 redirect is a common tool for web development and SEO. However, you must be careful. If redirects are used incorrectly , they can cause a lot of problems, including server crashes and a drop in search engine rankings.

Damaging the htaccess file during manual editing ¶

The htaccess file configures the Apache web server at the index level. Even the smallest incorrect change to the htaccess file can easily lead to websites being offline . This leads to the worrisome server error 500 or the White Screen of Death on WordPress .

To avoid this, it is best to make a copy of the htaccess file when editing it . This can easily be done from the command bar. Simply switch to the public web index of the site and use the cp command:

If any changes made in the htaccess file cause errors, it can be restored to its original version :

Chained redirects and redirect loops ¶

Redirects are useful but can cost a complete request-response cycle. If chained redirects are used, users have to wait, which can lead to an increased bounce rate. Search engines also rate sites negatively if they carry out multiple redirects in a row. As a rule of thumb, no more than three redirects should be set up.

The worst thing that could happen would be a redirect loop where two addresses constantly redirect to one another. This appears to users as the browser error ERR_TOO_MANY_REDIRECTS , meaning that the resource they want to access is no longer available. You should try and test redirects using cURL to make sure that you get the result you want.

Possible cache poisoning when using 301 redirects ¶

Incorrectly using 301 redirects can be the source of many headaches later on. Unlike temporary 302, 303 and 307 redirects, the 301 redirect tells the client to save the new URL in its cache . If you want to go back to the original URL, the client won’t be informed. Instead, it will keep trying to connect to the new URL. To counteract this, you can use temporary redirects or set the cache control value to the appropriate value.

Let’s set the cache control header to an hour. This ensures that later changes to the redirect target will be received by all clients.

If you use advanced redirects with rewrite directives, there’s a trick to setting the cache control header. We can define the environment variable limitcache as part of the 301 redirect rule. Finally, we can set the header, using the environment variable as a condition . This ensures that when redirecting, the correct header is always used:

Followed a 301 redirect and now your browser is refusing to access the original address? Simply attach a query string with ?foo=bar to the old address and force the browser to load the URL.

Related articles

What 'Error 404' means and how to fix it

What 'Error 404' means and how to fix it

How often have you stumbled upon a dead end while surfing the net? HTTP 404 error pages are commonplace online to inform users that the requested page isn’t available. As well as being annoying for visitors, they spell bad news for website owners since a dead link may have a bad influence on a website’s search engine ranking. In this article, we’ll demonstrate the importance of 404 pages and…

0x800f081f | How to fix this Windows update error

0x800f081f | How to fix this Windows update error

The purpose of a Windows update is to implement new features and fix existing issues, but the update process itself can often become a potential source of errors. In such cases, the system may respond with an error code like 0x800f081f, for example. More often than not, the error occurs because an essential update file is missing. We’ll show you the best strategies for troubleshooting this…

0x8000ffff | The best strategies for fixing error 0x8000ffff

0x8000ffff | The best strategies for fixing error 0x8000ffff

Error code 0x8000ffff is one of the most common error codes in Windows. It refers to different locations within the system rather than describing one unique error. A 0x8000ffff error is also called an “unexpected error” because it cannot be attributed to a single specific corrupted Windows component. We’ll show you the best ways to troubleshoot this problem.

0x8024200d: The Best Solutions to the Windows Update Error

0x8024200d: The Best Solutions to the Windows Update Error

Windows update errors can often be especially tricky. For instance, if the 0x8024200d error occurs while installing a new patch, even a restart won’t usually help. However, since continuous updates to Windows are vital for stability and security, you may have to fix this problem yourself if necessary.

Achieve your online goals faster with smart AI features, intuitive tools, and 24/7 support.

safari 301 redirect

  • Explore Our Geeks Community
  • Explain the Working of HTTPS
  • Shades of Red Color
  • SVG Stroke Properties
  • SVG defs Element
  • Embedding an online compiler into a website
  • HTML | Responsive Modal Login Form
  • Change Background color using onmouseover property
  • Programming For Beginners: 10 Best HTML Coding Practices You Must Know
  • Web Development
  • HTML <marquee> Tag
  • SVG Polyline element
  • HTML Color Codes
  • How to set the SVG background color ?
  • Which HTTP method is used to send the form-data ?
  • HTML onchange Event Attribute
  • HTML | <tfoot> bgcolor Attribute
  • HTML oninput Event Attribute
  • HTML | DOM Output htmlFor Property
  • HTML | <colgroup> bgcolor Attribute

Understanding 301 Redirection with its Implementation

Redirection in Computer Science is an essential beneficial service that helps website owners and administrators point their associated domains and subdomains to specific destination URLs when required. Redirection is performed when a specific web-based application is no longer using its original domain for data serving. All users linking to it need to be automatically informed about this inevitable change. So, in this case, Redirection comes into focus. This functionality helps domain administrators to preserve the relevance of the incoming relations to their domain or websites. So in this article, we will be understanding Redirection, 301 Redirection with its Duration, and performing a live demonstration of 301 URL Redirection.

  • URL Redirection: Explaining Redirection in simple words means establishing the relationship or visitor internet traffic to a newly created URL in place of an old URL. The famous protocols in networking HTTP, HTTPS redirect code is a method for yielding users and search engine features from one URL address to another URL address if a Web-based application on the internet’s Redirection points your previous or old address to a new address then, its a Redirection. When a visitor visits or access the old URL of a web-based application, the server takes the visitor to the newly created web page, which is set for Redirection in the configuration file by the Website Owner or Administrator. One may ask that, ‘Why do we need Redirection’? So the answer is pretty simple: the primary purpose or needs to perform Redirection is to transfer or migrate some critical or almost every content to a new web page from an old web page. We can use Redirection to delete old web pages permanently and can be used to change domain names and merge websites with another company server.
  • Status Codes: While browsing on the internet, you must have encountered error messages or error codes like 404. That’s an error, and many more, so these error messages are known as Status Codes. So these status codes are standard response codes that are returned from the web application server as per the request done by the user. These status codes also provide data or messages about the status of our requested query. Codes recognize the cause of the issue when the web application page responds appropriately to the request. In communication, every HTTP/HTTPS Protocol response message packet contains a status code in its first line, which indicates the result of the request query.

safari 301 redirect

Error Message with Status Code 404

In Data Communication, there are fives groups of status codes that are divided according to the code’s first digit:

  • 1xx (Information stating codes):  100,101,102,103
  • 2xx (Request Successful stating codes): 200,201, 202, 203,  204,205 206,  207, 208, 226
  • 3xx ( Redirection message stating codes): 300,301,302,303,304,305,306,307,308
  • 4xx ( Error Message Stating code): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 421, 422, 423, 424, 425, 426, 427, 428, 429, 431, 451
  • 5xx (Server Encountered error stating codes): 500,501,502,503,504,505,506,507,508,510,511
  • 301 (Moved Permanently) Status Code: As stated above, 3xx status codes are reserved for the Redirection alerts, so in this influential group, we have one of the codes, which is 301, also known as the Moved Permanently States code.  This code redirects the old URL address to a newly created or URL specified in the Location header or message packet. The visitors have to use this freshly specified URL rather than the original or old one. The target or the final resource is assigned to a unique or new permanent URL, and any future updates to this URL are used on the newly created URL. 301 Redirection is simply a permanent redirection that transfers the visitors to the redirected page from the old page URL. According to the Redirection aspect, 301 is the best methodology and best reliable for implementing redirects on any web application. To preserve the Current Search engine feature or functionality, 301 Redirection is used. We have to implement 301 redirections manually in the .htaccess configuration file.

Let’s understand about 301 redirections in detail.

1. Duration of 301 redirection: Most probably Moved Permanently or 301 Redirections redirect the specified domain or subdomain for approximately a year or sometimes more than a year. You need to check frequently if visitors are being transferred to your newly created URL( after a year). .htaccess plays an important role in direction. If you want to remove the redirection, you can modify the .htaccess file and remove the redirection, so afterward, the website won’t forward users to the new URL anymore.

Understanding 301 redirection via diagram:  

safari 301 redirect

301 Redirect from Old Page to New Page

From the above figure, the old page of the domain is redirected or moved permanently to the new page due to some internal application issue.

2. When to Perform 301 Redirection: 301 redirects are commonly used when:

  • Domain owner wants to change a page’s URL.
  • Domain owner wants to connect pages about the same topic.
  • Domain owners have to change a subfolder’s URL (e.g., to
  • Domain owners have moved a subdomain to a subfolder (e.g., to
  • Domain owners have to change domain names (e.g., to
  • Domain owners have to switch from HTTP to HTTPS (e.g., to

3. Technique to Implement 301 Redirection using .htaccess configuration file: htaccess is a configuration file for use on web servers running the Apache Web Server software. This file is actually responsible for Redirection.

Now let’s see the steps to be followed to implement 301 redirections: 

  • Create a .htaccess file, open notepad, name, and save the file as .htaccess (no extension to specify for file).
  • If .htaccess already exists on your server, then modify it and re-upload it.
  • Place the following code in your .htaccess configuration file.
redirect 301 /old/old_page.html
  • If the .htaccess file already has lines of code in it, skip a line, then add the above code.
  • Save the .htaccess file.
  • Upload this file to the main or root folder of your server.
  • Examine it by typing in the old address to the page you’ve changed. The server should instantly take you to the new location.
  • Note: Don’t add “http://www” to the first part of the statement – place the path from the top level of your site to the page. Also, assure that you devise a single space between these elements:
  • redirect 301 (the instruction that the page has moved)
  • /old/old_page.html (the original folder path and filename)
  • (new path and filename)

Example: In the below example, we are going to perform 301 Redirection. For this demonstration, we are hosting our files on LocalHost, i.e. XAMPP Server.

We have created two web pages named: 

  • OLD_PAGE.html

1. OLD_PAGE.html: In the OLD_PAGE.html web page, we will redirect this page to NEM_PAGE_REDIRECTED.html by adding the 301 Redirection code in the .htaccess file. .htaccess file is the configuration file for a web-based application. .htaccess file can manage all the internal structures through this file. The OLD_PAGE.html is the webpage that web application will redirect to another web page. When any user enters the OLD_PAGE.html URL, they will be automatically redirected to the New redirected page.

Filename: OLD_PAGE.html

safari 301 redirect


2. NEW_PAGE_REDIRECTED.html: To perform the redirection, we need the destination webpage from which our users will be sent from the old page to the new page. So our destination page or New Redirected page is NEW_PAGE_REDIRECTED.html. If the user enters the OLD_PAGE.html URL, then he will automatically switch to NEW_PAGE_REDIRECTED.html URL.


safari 301 redirect


3. .htaccess file for Redirection(Configuration file): As We stated above, .htaccess is the file responsible for any internal structure of any type of Redirection Feature. So owners should handle this file carefully. In this file, we need to add the code of the 301 Redirection. The code is just one line code in which we need to specify the old page and the new redirection page URL. This single line code is responsible for the 301 Redirection in the web-based application. As per the need, you can redirect number of various pages only you need to add the code in .htaccess file.

Note:  1. Make sure the file should be saved as .htaccess without extension. As in Geeksforgeeks Code Embed Editor there is no empty extension facility , I have added the source code in the HTML section but at your side you need to save it without any extension. 2. The # Added sentences are only for Readers Understanding, no need to add this lines while performing practical at your side.


 Explanation: As we enters the OLD_PAGE.html URL in the address bar the Web Application is automatically taking us to the other URL, and this Other URL is of NEW_PAGE_REDIRECTED.html page. So this is due to the 301 Redirection Code which is Written in the .htaccess file. Although copying the http://localhost:8081/OLD_PAGE.html link and pasting it to new tab will always redirect us to  http://localhost:8081/NEW_PAGE_REDIRECTED.html Page, till we remove the Redirection Code from .htaccess file. You can see in above output, I was trying to open http://localhost:8081/OLD_PAGE.html but as we have done redirection we were redirect to http://localhost:8081/NEW_PAGE_REDIRECTED.html.

This redirection will be lasting till the owner removes the redirection command from the .htaccess file. 

Please Login to comment...

  • Web Technologies
  • How To Earn Money Part-Time?
  • 10 Best AI 3D Generators in 2024
  • Top 10 Free Midjourney Prompt Generator [2024]
  • Top 10 Free AI Writing Tools for Content Creators
  • 10 Best Free AI Art Generators to Create Image From Text [Free & Paid]

Improve your Coding Skills with Practice


What kind of Experience do you want to share?


  1. How to Use 301 Redirects to Boost Traffic & Retain Authority

    safari 301 redirect

  2. 301 Redirect: When and How to use it?

    safari 301 redirect

  3. What is a 301 Redirect & How To Set Up it (2 methods explained)

    safari 301 redirect

  4. What is a 301 Redirect? How To Create A 301 redirect Properly Complete

    safari 301 redirect

  5. 301 Redirect Map

    safari 301 redirect

  6. What Is a 301 Redirect? Everything You Need To Know About 301 Redirects

    safari 301 redirect


  1. Lions Walk Past A Gnu Herd #Wildlife


  1. How long do browsers cache HTTP 301s?

    After a quick test, it seems that Safari clears its cache of 301s when it is restarted, but Firefox does not. When do IE, Chrome, Firefox and Safari clear their cache of 301s? For example, if I want to redirect 1.example to 2.example, but I accidentally set it to redirect to 3.example, that is a problem.

  2. How Do I Fully Flush Cached Redirects From Safari?

    I've already closed Safari, cleared ~/Library/Caches/ and ~/Library/Cookies/HSTS.plist but it still seems to be remembering the redirect when I re-open it. Where else could Safari be storing this information?

  3. Safari 'forgetting' to 301 Redirect

    Safari 'forgetting' to 301 Redirect I'm seeing something that looks like a major bug in Safari that I cannot reproduce in any other browser. I'm attempting to setup a 301 redirect on my website. When I first type the URL it redirects properly.

  4. Browser Behavior and 301 Redirects

    Does Safari Cache 301 Redirects? Yes, Apple's Safari browser caches 301 redirects locally. Unless caching directives in the Expires or Cache-Control HTTP headers explicitly state otherwise, Safari keeps the cached response indefinitely.

  5. How to Fix The ERR_TOO_MANY_REDIRECTS Error

    ERR_TOO_MANY_REDIRECTS in Microsoft Edge Safari. In Safari, it will show as Safari Can't Open the Page (as seen below). ... For example, on the site below, it has a 301 redirect loop back to itself, which is causing a large chain of faulty redirects. You can follow all the redirects and determine whether or not it's looping back to itself ...

  6. Safari Redirecting http to (non-existent) https

    6 Answers Sorted by: 35 +50 If the site has previously indicated to Safari that it wishes to always be accessed over HTTPS through HSTS ( HTTP Strict Transport Security ), then Safari will always try to redirect to HTTPS. You can clear the HSTS cache by deleting ~/Library/Cookies/HSTS.plist.

  7. What is a 301 Redirect & How To Set Up it (2 methods explained)

    301 redirects are also known as permanent redirects and hence all the qualities of the redirected page such as MozRank, page authority, traffic value, PageRank, etc. will get attributed to the detour page. This makes the detour page represents the redirected one completely.

  8. The Ultimate Guide to Use and Implement 301 Redirects

    Defined in server configuration files, these redirects are processed on the server (Apache, Nginx, Windows, etc.) before any content is sent to the browser. The server sends an HTTP response with the appropriate status code (e.g., 301, 302, 307) and the URL the browser should redirect to in the 'Location' header.

  9. 301 redirects: what they are and how to use them

    A 301 redirect is a type of HTTP status code. Web browsers and site servers use these three-digit codes to communicate information about the status of a website or page. For example, when you go to visit a website, your browser requests access from the site's server, and the server responds with a HTTP status code.

  10. What is a 301 Redirect, and When Should You Use One?

    A 301 redirect passes all ranking power from the old URL to the new URL, and is most commonly used when a page has been permanently moved or removed from a website. 301 is one of many possible HTTP status codes, some of which you've probably heard of (including 404 - Not Found, 403 - Forbidden and, 500 - Server Error ).

  11. 301 Redirects Guide for Beginners

    301 redirect is a useful tool for diverting users from your old URL to your new URL. This may be required in one of the following situations: To avoid 404 not found error in situations like change in the existing page URL, an old webpage is deleted or m erging two sites. Canonical URLs to use www or non-www version.

  12. Safari settings for redirects

    If you are having trouble with pop-ups on your iPhone, iPad or Mac, you can find helpful tips and solutions on this Apple discussion thread. Learn how to block, allow or customize pop-ups in Safari from other users and experts. Join the conversation or ask your own question.

  13. 301 Redirects and Reversing a 301 Redirect // Chad Schulz

    301 Redirect Reversal. In general, it seems to be the case that when a browser loads it's cached 301 redirect only to find it's actually a 301 back to the source, it breaks the infinite loop and goes back to the server to revalidate the requests. For Edge, Chrome, and Opera the 301 redirect reversal takes effect immediately and the browsers ...

  14. Can You Remove & Reverse A 301 Redirect?

    Scenario #1: Single-page, full reverse Let's start with the easiest scenario. Page A 301-redirects to Page B (A→B) and you'd like to reverse that. I'm assuming here that Page B will be going away completely. Here are the basic steps: Remove the 301-redirect from A→B Add a 301-redirect from B→A Re-point internal links to Page A

  15. 301 redirect: the definitive guide

    We can then redirect one page of the site to another simply by filling in the following fields: Source URLs: here you have to insert the source URL (the old article or the old page).. Destination URL: here you have to insert the destination address.. Redirection Type: we can choose between 301 redirect (permanent) or temporary redirect (302 or 307).. In the end, we click on Add Redirection.

  16. forwarding http to https doesn't work on iOS Safari

    apache .htaccess https safari http-status-code-301 Share Improve this question Follow asked Jul 1, 2016 at 20:46 Atma 29.4k 56 200 302 Does it come up with an error message at all? - Joe Jul 1, 2016 at 20:58 @thickguru It says: "safari could not open the page because the server stopped responding. - Atma Jul 1, 2016 at 21:06

  17. What is a 301 redirect?

    A 301 redirect is a permanent redirect of a web address to a different one. In this article, we'll explain the technical background and show you how you can set up a 301 redirect using htaccess. Contents Why are 301 redirects needed? How do 301 redirects work? What are the problems and risks associated with using 301 redirects?

  18. Understanding 301 Redirection with its Implementation

    This file is actually responsible for Redirection. Now let's see the steps to be followed to implement 301 redirections: Create a .htaccess file, open notepad, name, and save the file as .htaccess (no extension to specify for file). If .htaccess already exists on your server, then modify it and re-upload it.

  19. Force browsers to forget cached redirects?

    I inherited a domain that previously had a 301 redirect from the root ("/") to "/index.shtml" I've removed the redirect and a different site on the domain, but people who visited the site in the past will have the redirect behavior cached in their browsers... for a terribly long time, unless they manually clear their caches.

  20. The Doobie Brothers 2024 Tickets Aug 29, 2024 Denver, CO

    Buy The Doobie Brothers 2024 tickets at the Ball Arena in Denver, CO for Aug 29, 2024 at Ticketmaster.

  21. CNN 10: The big stories of the day, explained in 10 minutes

    Then, we head to just outside of Hong Kong, where we go on a "nocturnal safari" with a photographer and find an array of wildlife creatures. And before you go, CNN 10 heads to the Windy City and ...

  22. Client Web Browser Behavior When Handling 301 Redirect

    1.2: Site A responds with 301 Redirect to Site B. 1.3: Browser sends GET to Site B. Any Subsequent Times Around: 2.2: User clicks on a link directed at Site A. 2.2: Browser sees that, due to a past 301 redirect, Site A should now be Site B. 2.3: Without initiating any request whatsoever at Site A, browser initiates GET at Site B.

  23. google chrome

    301 redirect works in Firefox but not Safari or Chrome? 5. Redirect all traffic to temporary domain with 307 redirection. 11. Chrome and Safari caching 302 redirect. 7. Which browsers support 307/308 redirects and how do they handle them? Hot Network Questions Missing A Figure