301 error apache

301 error apache

The HTTP response status code 301 Moved Permanently is used for permanent redirecting, meaning that links or records returning this response should be. If a POST requests is answered with either HTTP 301 Moved Permanently or with 302 Found – the redirect is not automatically followed. What do you do? You use a 301 permanently moved status code. These types of codes are meant to route your users to a new location. It's that line that.

301 error apache - once

A 301 Moved Permanently is an indicating that the requested resource has been permanently moved to a new URL provided by the response header. The category of response codes are used to indicate redirection messages to the client, such that the client will become aware that a redirection to a different resource or URL should take place.

It can be a challenge to differentiate between all the possible HTTP response codes and determine the exact cause of a message like the code. There are dozens of possible HTTP status codes used to represent the complex relationship between the client, a web application, a web server, and often multiple third-party web services, so determining the cause of a particular status code can be difficult. In this article we'll examine the code by looking at a few troubleshooting tips, along with some potential fixes for common problems that might be causing this issue, so let's get started!

The Problem is Server-Side

All HTTP response status codes that are in the category are considered . Such codes indicate to the user agent (i.e. your web browser) that an additional action is required in order to complete the request and access the desired resource. Unlike gateway related response codes, like the we've looked at recently, which may indicate issues either on an upstream server or the client, the code generally indicates an issue on the actual web server hosting your application.

That said, the appearance of a is usually not something that requires much user intervention. Most browsers should automatically detect the response code and process the redirection action automatically. The web server hosting the application should typically include a special header as part of the response it sends to the client. This header indicates the new URL where the requested resource can be found. For example, if a request comes in to access the URL , but the web server is configured to forces redirection to a secure version using , the server response will include the header. This tells the browser that it should redirect this request (as well as all future ones) to to the secured URL of . In most cases, the browser will automatically detect this response code, read the new URL, and redirect the request to that new location. It is considered best practice to use a redirection to transition a user agent from HTTP to the secure HTTPS. Thus, if you attempt to go to the insecure URL of https://airbrake.io right now, you'll automatically be redirected to the HTTPS version of the site (https://airbrake.io).

Since the indicates that something has gone wrong within the of your application, we can largely disregard the side of things. If you're trying to diagnose an issue with your own application, you can immediately ignore most client-side code and components, such as HTML, cascading style sheets (CSS), client-side JavaScript, and so forth. This doesn't apply solely to web sites, either. Many smart phone apps that have a modern looking user interface are actually powered by a normal web application behind the scenes; one that is simply hidden from the user. If you're using such an application and a occurs, the issue isn't going to be related to the app installed on your phone or local testing device. Instead, it will be something on the server-side, which is performing most of the logic and processing behind the scenes, outside the purview of the local interface presented to the user.

All of that said, if your application is generating codes improperly or unexpectedly, there are a number of steps you can take to diagnose the problem.

Start With a Thorough Application Backup

As with anything, it's better to have played it safe at the start than to screw something up and come to regret it later on down the road. As such, it is critical that you perform a full backup of your application, database, and so forth, before attempting any fixes or changes to the system. Even better, if you have the capability, create a complete copy of the application onto a secondary server that isn't "live," or isn't otherwise active and available to the public. This will give you a clean testing ground with which to test all potential fixes to resolve the issue, without threatening the security or sanctity of your live application.

Diagnosing a 301 Moved Permanently Response Code

A response code indicates that the server believes that the requested resource is invalid and that the request should be redirected to a new, "proper" URL. I use the word here because it's entirely possible that the server is misconfigured or bugged in some way, which is causing it to provide codes for resources/URLs that are totally valid. Thus, a large part of diagnosing the issue will be going through the process of double-checking what resources/URLs are generating response codes and determining if these codes are appropriate or not.

That said, if your application is responding with codes that it should not be issuing, this is an issue that many other visitors may be experiencing as well, dramatically hindering your application's ability to service users. We'll go over some troubleshooting tips and tricks to help you try to resolve this issue. If nothing here works, don't forget that Google is your friend. Don't be afraid to search for specific terms related to your issue, such as the name of your application's CMS or web server software, along with . Chances are you'll find others who have experienced this issue and have come across a solution.

Troubleshooting on the Server-Side

Here are some additional tips to help you troubleshoot what might be causing the to appear on the server-side of things:

  • - Your application is likely running on a server that is using one of the two most popular web server softwares, or . At the time of publication, both of these web servers make up of the world's web server software! Thus, one of the first steps you can take to determine what might be causing these response codes is to check the configuration files for your web server software for unintentional redirect instructions.

To determine which web server your application is using you'll want to look for a key file. If your web server is Apache then look for an file within the root directory of your website file system. For example, if your application is on a shared host you'll likely have a username associated with the account on that host. In such a case, the application root directory is likely something like , so the file would be at .

If you located the file then open it in a text editor and look for lines that use directives, which are part of the module in Apache. Covering exactly how these rules work is well beyond the scope of this article, however, the basic concept is that a directive defines a text-based pattern that will be matched against entered URLs. If a matching URL is requested by a visitor to the site, the directive that follows one or more directives is used to perform the actual redirection of the request to the appropriate URL. Therefore, if you find any strange or directives in the file that don't seem to belong, try temporarily commenting them out (using the character prefix) and restarting your web server to see if this resolves the issue.

On the other hand, if your server is running on , you'll need to look for a completely different configuration file. By default this file is named and is located in one of a few common directories: , , or . Once located, open in a text editor and look for the or directives. For example, here is a simple (i.e. a named set of directives) that configures a virtual server by creating a redirection from to the proper URL:

directives in are similar to the and directives found in , as they tend to contain more complex text-based patterns for searching. Either way, look through your file for any abnormal or directives and comment them out before restarting the server to see if the issue was resolved.

  • - Nearly every web application will keep some form of server-side logs. are typically the history of what the application did, such as which pages were requested, which servers it connected to, which database results it provides, and so forth. are related to the actual hardware that is running the application, and will often provide details about the health and status of all connected services, or even just the server itself. Google "logs [PLATFORM_NAME]" if you're using a CMS, or "logs [PROGRAMMING_LANGUAGE]" and "logs [OPERATING_SYSTEM]" if you're running a custom application, to get more information on finding the logs in question.
  • - If all else fails, it may be that a problem in some custom code within your application is causing the issue. Try to diagnose where the issue may be coming from through manually debugging your application, along with parsing through application and server logs. Ideally, make a copy of the entire application to a local development machine and perform a step-by-step debug process, which will allow you to recreate the exact scenario in which the occurred and view the application code at the moment something goes wrong.

No matter what the cause, the appearance of a within your own web application is a strong indication that you may need an error management tool to help you automatically detect such errors in the future. The best of these tools can even alert you and your team immediately when an error occurs. Airbrake's error monitoring software provides real-time error monitoring and automatic exception reporting for all your development projects. Airbrake's state of the art web dashboard ensures you receive round-the-clock status updates on your application's health and error rates. No matter what you're working on, Airbrake easily integrates with all the most popular languages and frameworks. Plus, Airbrake makes it easy to customize exception parameters, while giving you complete control of the active error filter system, so you only gather the errors that matter most.

Check out Airbrake's error monitoring software today and see for yourself why so many of the world's best engineering teams use Airbrake to revolutionize their exception handling practices!

openssl s_client -connect david.ncifcrf.gov:443 

What is a 301 Moved Permanently: And How to Fix It?

A 301 redirect is an essential when setting up a new webpage or migrating a website to indicate that what you’re looking for – is no longer available – and has permanently moved to a new location. But what if your 301 moved permanently status codes isn’t working as intended or is bringing up the wrong resource? This type of website maintenance is essential in making sure your website is healthy, we will explain the common types of redirect issues and errors and how to fix them. 

What is a 301 Moved Permanently Redirect?

Each time you visit a website, there is a request sent from your browser to a website’s server. The web server receives this request, processes it, and sends along an HTTP header and HTTP status code. This HTTP status code normally will not be seen by someone visiting the website unless there is an error. If a server responds with an HTTP status code message, that is its way of communicating that there is some sort of an error. Within each type of HTTP status code, there is a category type that can be identified by a number that relates to the reason as to why the error occurred.

301 Moved Permanently

In the case of a 301 redirect, this type of HTTP status code occurs when there was supposed to be a redirection of a request to a new URL link.  This HTTP status code falls under the 3xx category of response codes, all of which are redirection-related requests. 

In the case of the 301 redirect, the problem occurs when there is an issue communicating a redirection request from an old to a new permanent URL link on a website. This type of error can occur when updates or changes are made to a website, but the server response redirecting the user to the new URL link has failed.

Why Do 301 Moved Permanently Occur?

Since the 3xx category of HTTP status codes are considered redirection messages, this indicates that additional action is necessary to access the website. Unlike 5xx HTTP status codes that relate to communication issues between two servers, the 301 moved permanently error occurs from an issue from the inbound website’s URL linking, and not the client trying to access it. While most browsers will automatically detect a 301 moved permanently response code and process a redirection request immediately, if the URL is not linked properly, a 301 error message will appear. Some other reasons 301 errors occur include:

  • New creation of a website
  • New webpage was created
  • Broken URL links
  • Fixing a webpage and want it to redirect to another page

How Can 301 Errors Damage a Website’s Reputation?

301 errors can impact a brand’s reputation in two ways — through search engine rankings and user experience. If your website has redirect request errors, search engines will not properly index it, and therefore decrease search rankings from an inability to detect page content. 301 errors also cause frustration for visitors as they are unable to find important content on specific pages of a website.

How do you fix a 301 error message?

1. Check Your Htaccess Files for Errors in URL Linking

Most websites run on one of these two types of popular server software — Apache. Within these server applications you will then look into the htaccess file within the root directory of your website files, as this will help determine where any redirection instructions are located.

What is an Htacess File?

Htacess stands for hypertext access, and is a type of server configuration file. Each file contains configuration directives towards a server within a directory. In simpler terms, each htaccess file basically gives instructions to a server, which could include passcode requirements for certain areas of a directory, as well as configuration to automatic redirects on certain areas of a website. If you need to update an htaccess file, it is important to ensure the file is properly titled ‘.htaccess’ only.

In order to locate the htaccess file in Apache, you can click on the username of your account associated with your server hosting. Once you have located the htaccess file within your directory, you can open it in a text editor and locate the lines Rewrite directives, which will allow you to modify these to ensure there are matching URL links for any redirects within your website.

There are two types of Rewrite directives that can be modified:

RewriteCond

RewriteRule

You will want to go through both of these within the htaccess file to make sure there aren’t any redirects to URLs that no longer exist. If there is, you can temporarily remove them and restart your website server to see if that resolves the issue.

If your server runs on nginx, your rewrite directives are identified as return or rewrite directives as opposed to RewriteCond and RewriteRule.

2. Use a Third Party Tool to Check for Any 301 Redirects

The free tools below are a great way to run a quick website audit and give some insights on any 301 moved permanently errors that might need to be modified.

https://www.redirect-checker.org/

https://httpstatus.io/

https://sitechecker.pro/redirect-checker/

3. Backup Your Website

Before trying to diagnose any website related server issues, a first recommendation would be to perform a full backup of your website database before attempting any of the steps below. This will ensure that no data loss will occur when trying to resolve a 301 Moved Permanently Error. 

4. Check Your Server Logs

Checking your server log will allow you to better understand a server’s current status. The server logs can help indicate any specific files that might be causing 301 error messages, allowing you to easily catch and adjust these files manually. 

5. Check Your Sitemap

Search engines use your sitemap to crawl a website so it is important to make sure there are no 301 errors embedded into your URLs. If you have any 301 status codes for nonexistent pages, you will want to make sure these are removed. This can be done by:

  • Accessing your website’s sitemap
  • Download a full list of your URLS
  • Filter for any 301 status codes within the list
  • Delete the 301 status codes and replace them with the correct URL update

6. Check Any Custom Code Files

If you have any custom code embedded into your website with errors, it may cause redirect issues. The easiest way to test this is to remove the line of custom code and refresh the page to see if the error message goes away to understand if this was the root of the problem.

7. Change any HTTP Response Codes to 200 If You Do Not Want A Redirect

Once you have identified the 301 redirects on your website, you can alter any unintentional redirects by changing the response code to the 200 category.

8. Remove Any Redirect Chains or Loops

A redirect chain occurs when there is more than one redirect between two URL links. First identify if any of these chains exist, then replace them with a direct link to the final URL.

A redirect loop is a communication error that occurs when one URL redirects back to another URL within that chain, causing a 301 error. You will want to check your URL list for any 301 redirects to understand if any of these loops or chains exist within your website.

9. Fix Any Broken Redirects

Broken redirects occur when a URL links to a page that no longer exists. You can identify broken redirects using the same steps mentioned above:

  • Access your website sitemap
  • Download a list of your URLS
  • Filter the list for any 301 status codes
  • Bring back the pages that no longer exist or update the URL to reflect the correct page it should be redirected to

Since both search engines and visitors use 301 redirects as a way to identify a new page destination, it is important that these links are updated properly to reflect the appropriate URL where they should be linked. These error messages can negatively impact both search engine rankings and user experience if unnoticed.

Guide to 301 Redirects with an .htaccess File

A 301 redirect using an .htaccess file is a redirect that you create when you rewrite a piece of code on your site.

There are many reasons why you might want to input a 301 redirect on your site, but how do you do it, and why should you do it the .htaccess way? We’ve got the answers.

But before we go into specifics, let’s dive into 301 redirects.

What Is a 301 Redirect?

A 301 redirect is a permanent redirect. When a user tries to access an old URL, the server sends their browser the 301-Permanently Moved status code and sends them to another page. This is useful for site owners and users because it means they are directed to the next most relevant page. 

301 redirects are useful for search engines too because they help to keep their indexes updated. They inform search engines that content has been moved and ensure that the visibility associated with the original page is transferred to the new URL.

For more information, take a look at our comprehensive SEO guide to 301 redirects.

What Is an .htaccess File?

An .htaccess file is a part of what controls the high-level configuration of your website. You edit the contents of your .htaccess file to enable and disable certain features of your server software without editing in the server configuration file directly. It’s a pretty easy way to make important changes, but you have to be really careful that you’re editing the code correctly. One mistake in your code can cause a lot of problems for users. 

This means that a 301 redirect using an .htaccess file is a permanent redirect implemented via your .htaccess file rather than the server configuration file. 

When Should You Use a 301 Redirect with an .htaccess File?

A 301 redirect using an .htaccess file can generally be used in three different scenarios:

  1. To redirect visitors after you’ve moved to a new domain
  2. To redirect visitors after you’ve moved old site pages to a new site structure
  3. To redirect visitors to new pages after you’ve combined two sites 

It’s pretty easy to do. We’ll walk you through how it works. 

How to Do a 301 Redirect with an .htaccess File

A 301 redirect is executed differently depending on the server you use. The .htaccess method is usually used on Apache servers but can be implemented on other servers too.

How to Do 301 Redirects with .htaccess Files on Apache

Before you do anything, you need to locate the RewriteEngine, which you can find in the mod_rewrite module in Apache. You can load it using the following code: 

Then you can add all your rules below “RewriteEngine On”. The rules you add depend on what exactly you want to redirect. 

Redirecting a Single URL

When redirecting a single URL, all you have to do is add this code (make sure you substitute “oldpage” and “newpage” for your page names!):

Redirecting a Single Folder

When redirecting a single folder to a new location, you would use the following:

We’ve used “folder” and “location” as our examples. Substitute your folder and location names!

Redirecting www to Non-www with a 301 .htaccess Redirect

Maybe you want to run a redirect because you don’t want to use a www subdomain. If this is the case, you’ll need to redirect to a non-www version. Here’s what you need; just replace “example” with your own domain:

How to Do 301 Redirect with .htaccess Files on WordPress

Firstly, you’ll have to connect your site’s server to edit your .htaccess file. To do this, you have two options.

  1. Connect to your server through FTP
  2. Use the built-in File Manager tool, which you can find in cPanel

To use the built-in File Manager tool, log in to your cPanel dashboard and locate the tool. Then back up your .htaccess content and use the Edit function to add your 301 redirect code. This will take you to the text editor. From here, you can add the code you need. 

Of course, the 301 redirect code you need depends on what you want to achieve. 

Redirecting a Single Page

To redirect a single page to another one, you’ll need to add the following code, replacing “oldpage”, “example”, and “newpage” with your details:

Redirecting a Domain Name 

To redirect an entire domain name to another domain name, use the following code:

Just, as always, make sure that you put in your information instead of “oldsite” and “newsite”.

How to Do 301 Redirects with .htaccess Files in Windows

If you use Windows to run your site, we’ve also got you covered. 

Redirecting a Single Page

To redirect a single page, type in the page name under the Pattern field. Your code might look something like this, with your details subbed in:

Redirecting an Entire Website

Redirecting your entire site to another domain is also super easy. You just need to add the following to your .htaccess file:

And replace “newsite” with your domain name!

For more information, check out our article on the 16 crucial SEO steps when redirecting an entire website. 

Redirecting Old URLs to New URLs

If you change your filenames for specific pages, you can redirect to the new URLs by inputting the following code and replacing “oldpage”, “example”, and “newpage” with your info:

How to Identify & Fix Redirect Issues

SEO issues aren’t foreign to any of us, and, like any other feature, redirects can cause problems too. 

With our Site Audit tool, you can quickly recognize and resolve any problems you might have with your redirects. 

The Site Audit tool can recognize problems like:

  • No redirect or canonical to HTTPS homepage from HTTP version
  • Redirect chains and loops
  • Pages with temporary redirects
  • Pages with a broken canonical link
  • Broken external links
  • Broken internal links

So, if you’ve just added some redirects to your site, here’s how to set up your Site Audit to find any technical issues and get them resolved. 

  1. Open the Site Audit tool and click “New Site Audit” to create a new project. 
  2. Give your new project a name:
  1. Configure your basic settings and then let the Site Audit run.
  2. Once your crawl has finished, head over to the Site Audit dashboard to see what you can discover. 

By clicking on “Top Issues”, you’ll be able to see all your issues at a glance. You can even filter by the check you’re interested in:

And to find out more about any of these issues, you just have to click on them.

Once our Site Audit tool has told you what to be on the lookout for, solving your issues is going to get a whole lot easier, and you can carry on inputting redirects with confidence. 

Key Takeaways

Now that we’ve discussed the ins and outs of 301 redirects using an .htaccess file, let’s review:

  1. Always double-check the edits you make to your .htaccess file before you go live. One typing mistake could cause a lot of problems for your users. 
  2. Remember that a 301 redirect is executed differently depending on the server you use. You may need to use different pieces of code depending on how you run your site. 
  3. If something goes wrong, you don’t need to panic. Once you’ve inputted your 301 redirects with .htaccess, turn to the Semrush Site Audit tool for help in spotting any issues and resolving them. 

Now it’s time to get started on your 301 redirects with .htaccess. They might be easier than you expect!

Mazeless" width="1024" height="254">

Example: http://www.mazeless.com redirects to the secure version https://www.mazeless.com

When you try to access the first link, our server:

  • Sends your browser information
  • Responds with “This page is permanently moved”
  • Sends the new location

Your browser then redirects to the new URL. As a user, you likely don’t even know that an error 301 occurred.

Types of redirects

Communication between browsers and servers happens with every request. While we’re focusing on 301 redirects, it’s important to know that the following redirects also exist:

  • 302: The difference between a 301 redirect vs. 302 redirect is that a 302 is a temporary redirect.
  • 307: The same as a “Moved Temporarily” redirect, like the 302, though it’s not used often.
  • 308: Works the same as a 301 redirect and is treated as such by Google.

How do I set up 301 redirects?

You can set up a 301 redirect using a few methods:

Can you do a JavaScript 301 redirect?

301 HTTP response is sent by the server and JavaScript is executed on the client side. So JS is not a good option for SEO redirects.

JS 301 redirect is followed by search engines. One issue is that if a user’s browser has JavaScript disabled, it won’t work. You can set up a JavaScript 301 redirect like this:

However, note that the JavaScript redirect 301 should be used as a last resort if you don’t have access to meta refresh or server-side redirects.

Meta Refresh

Meta refreshes are done on a page-by-page basis and look something like this:

Server-Side Redirect

An optimal 301 redirect will occur on the server-side using either server-side scripts, a 301 redirect htaccess file or something similar. For example, in PHP, the redirect may look something like this:

What is a 301 .htaccess redirect?

A 301 redirect using .htaccess means that a .htaccess file is used to make the redirect. This redirect is for Apache servers and will look like this:

However, you can use regular expressions and make .htaccess files rather complex. A good guide on using .htaccess redirects can be found on DreamHost.

Do 301 redirects affect SEO?

If GoogleBot got an http 301 response at crawl time, does it impact SEO? It won’t result in lost SEO value, but it can be used to shape certain pages into authority pages on your site. Let’s go through a few common questions relating to 301 redirects and SEO.

Are JavaScript redirects bad?

Yes and no. It’s better to use a .htaccess or server-side redirect than a JavaScript redirect, but as Google states, “Only use JavaScript redirects if you can’t do server-side or meta refresh redirects.”

How to Redirect a URL in WordPress?

WordPress has a lot of plugins that you can use to handle redirects. If you need a 301 redirect tool that’s designed for WordPress, try the following plugins:

If you have access to the server, you can use a .htaccess file for redirecting. An example of redirecting one page to another is below:

Do 301 Redirects Pass Link Juice?

Yes, they do. However, you might not receive 100% PageRank. Matt Cutts, former Head of Webspam at Google, said the amount of PageRank that dissipates through a 301 is the same as with a link. So, you might lose some link juice, but the impact is minimal at best.

You can see a great video on the topic by Matt directly below:

However, Google seems to have changed its stance and states that PageRank doesn’t get lost with a 3## redirect any longer. John Mueller from Google Switzerland says that you must redirect 404s to somewhere relevant.

For example, if you redirect /cats/ to /fish/, that will be seen as a soft 404 error and not pass any value. Instead, if /cats/ is redirected to /kittens/, it will pass value.

In fact, there’s a great video with John on this very topic below:

How to Use 301 Redirects for Link Building?

An issue with 301 redirect Google ranking manipulation is that Google is well aware of these tactics. The search giant doesn’t want you to purchase a domain, perform a 301 redirect, and manipulate the search results.

Instead, the best 301 redirect SEO practice is to:

  • Redirect older deleted pages back to existing pages where it makes sense

Why?

When the content is similar and of value to the user, it will pass link juice along. You can also merge two pages together that were underperforming. For example, say we had two pages on 301 redirects that didn’t perform well.

We might redirect those pages to this guide to consolidate authority.

A few times you may want to do this is when:

  • Keyword cannibalization exists and you can redirect content to rank higher for a keyword.
  • Merging pages together into helpful guides makes sense for your audience.
  • You create revamped pages and the old URLs don’t make sense to use. In this case, you can redirect them to the new pages.

When you redirect content on your own site, it’s possible to consolidate your authority and boost your rankings in a similar way to link building.

But without the additional work.

In which situations are 301 redirects commonly used?

What’s the difference between a 301 vs. 302 redirect for SEO? When should you use a 301 redirect over the many other types available?

When should you use 301 redirects?

A 301 redirect should be used in the following cases:

  • A page that no longer exists has been removed and you want to pass its value to another relevant page
  • You want to consolidate pages or content to new URLs
  • You redirect a site
  • You are changing from non-www to www
  • You are changing from HTTP to HTTPs
  • You needed to change URLs for a page
  • The redirect is permanent

If the redirect is only temporary, you’ll want to use a 302 redirect or something similar.

301 Redirects vs. Canonical Tags

A 301 redirect and canonical tag are similar, but they’re not the same. A 301 redirect tells search engines that the page, folder, site or file no longer exists and that you can find this resource at another location.

The redirect is also permanent.

However, Canonical attributions are different because the “rel=canonical” tag is used when you have:

  • Multiple pages with the same content
  • Content on certain pages that is very similar

For example, if you sell a product that may be in multiple categories, it may be found on many product pages. Since these duplicate pages exist, using a canonical tag makes sense.

Migrating Your Site to a New Domain

You can migrate one site to another with precision using a 301 redirect. Let’s take a look at how this is done using Apache’s .htaccess file.

Redirect an old page to a new page

A bulk 301 redirect generator works great if you have multiple pages to redirect, but you can also do the following:

Redirect an old domain to a new domain

If you want to redirect an entire domain and all of its content to another domain, you can use the example below:

You can also use 301 moved permanently to Facebook for businesses that abandon their website and move to Facebook instead.

Redirect entire domain from non-www to www

If you want to have www in front of your site name, you can do it with just three lines of code in your .htaccess file:

Redirect entire domain from HTTP to HTTPS

When going from HTTP to HTTPS, which is something all sites should be doing, you can use the code below:

Redirect entire domain from non-www to www and HTTP to HTTPS

Similar to the last point, you can redirect a non-www and HTTP site to www and HTTPS with the following code:

Redirect www to non-www with SSL/HTTPS via .htaccess

301 Redirects on Apache Servers

Apache uses .htaccess files for redirects, and you can use complicated regular expressions to refine how your redirects work. Since regular expressions can be very complex, you may want to read through a few of the following guides:

Common 301 Redirect Mistakes & How to Avoid Them

Redirect mistakes are often difficult to pinpoint because a small space or letter capitalization issue can cause a redirect not to work. The easiest way to avoid errors is to use a plugin or software to create redirects. A few additional tips for avoiding redirect mistakes are:

  • All URLs are case-sensitive. You need to either enter the exact URL or use the “NC” rule in your .htaccess file.
  • Create a database of all redirects to help avoid redirect loops and chains.
  • Test all redirects you create to ensure that they’re working properly.

If you find that your 301 redirects aren’t working properly, use the tips below.

How to fix existing 301 redirect issues on your site

If you find that you have a problem with 301 redirects on your site, you’ll want to look over your implementation and make sure that everything is 100% right. A few tips include:

  • Spelling
  • Destination
  • Capitalization

Ensure your HTTP version is pointing to the HTTPS version of your site.

Once this is done, you’ll want to do a few things:

  • Any pages in your sitemap that have a 301 redirect should be removed since you don’t want Google to keep looking for the page after it’s gone.
  • Check the page for redirect chains. For example /page1/ goes to /page2/ and that goes to /page3/. Instead, redirect /page1/ to /page3/ and /page2/ to /page3/.
  • Pages that are stuck in a redirect loop will need to be reviewed and the error corrected by verifying that two directs aren’t pointing back to each other and restarting the redirect cycle.
  • Redirect pages that go to a 404 error page aren’t providing your site with maximum value. If you find that there’s a broken redirect, be sure to fix it by either creating the 404 page or pointing the redirect to a new page.

Monitoring your site’s redirects can be very complicated. Auditing your site using automation is critical.

Click here to give our tool a try to master redirects.

How to resolve 301 moved permanently error

If you’re running into an error, use the tips above to try and fix the redirect error. You can also:

  • Check Your Htaccess Files for Errors in URL Linking
  • Run audit tools to learn what’s causing the error
  • Check Your Server Logs
  • Check Your Sitemap

Always back up your files and .htaccess file before editing so that if you make matters worse, you can restore the old version.

Summary

Using 301 redirects for SEO takes time, and it shouldn’t be done lightly. You must spend time to verify that each redirect works, has a purpose and is a good solution for your site. If your site has pages that need to change their locations or pass value from one logical page to another, 301 redirects can help.