Home
/
Website Help
/
308 Status Code: What is it, When to use it & How to set it?

308 Status Code: What is it, When to use it & How to set it?

The 308 status code is one of the numerous HTTP response status codes a web server returns to a request made by a client.

In particular, the 308 status “Permanent Redirect” is one of the various redirect types instructing web browsers and other clients how to proceed going forward to the new location. But how is it different from the other redirects, and when should you use it – we will unravel these questions, so read on.

The 308 status code means that the target resource, which the users are trying to access, has permanently moved to a new URL and redirects them to the new location.

Browsers are expected to update the location header of the resource and automatically redirect all subsequent original address requests to the new URL. Similarly, search engines must update the resource location with the new address in their databases.

At first glance, the 308 Permanent Redirect HTTP status code is similar to the 301 “Moved” status code. However, there is one key difference – the 308 permanent redirect requires clients to use the method of the original HTTP request for the subsequent request to the new location. In contrast, the original request method can change for future requests with a 301 redirect. This makes the 308 redirect much safer, as switching the request methods facilitates security exploits.

Let’s take a look at how the 308 response code works in the following example.

  1. You submit an order on an online shop, and your browser sends a POST request to the web server.
  2. However, the checkout page address has been moved to a new URL location, and the web server returns a 308 status code.
  3. Your browser sends a new POST request to the new page preserving your order details where you can complete the purchase.
HTTP Status Code 308 Permanent Redirect

If the web server were to return a 301 HTTP response code, your browser might have been instructed to switch from a POST to a GET method. Thus, instead of you sending your order details to the web server, the web server sends back data that might compromise your device.

What Is the Difference between the 308 Status Code and Other 3XX Codes

The 3XX HTTP status codes are all about redirections. However, each code within this category has a specific use case and conveys different characteristics to the redirect process. Here is a direct comparison of the most fundamental properties between the four standard HTTP response status codes used for redirection – 301 Moved, 302 Found, 307 Temporary Redirect, and 308 Permanent Redirect.

308 Permanent Redirect 301 Moved 302 Found 307 Temporary Redirect
Common use Permanent redirect Permanent redirect Temporary redirect Temporary redirect
HTTP Request Method The HTTP request method doesn’t change. Allows the HTTP request method to be changed. Allows the HTTP request method to be changed. The HTTP request method doesn’t change.
URL Location Instructs search engines and browsers to update the resource location with the new URL address. Instructs search engines and browsers to update the resource location with the new URL address. Instructs search engine crawlers and browsers not to update the resource location. Instructs the user agent not to update the resource location.
SEO Impact Passes the SEO value of the original location to the new URL. Passes the SEO value of the original location to the new URL. Doesn’t pass the SEO value of the original URL to the new location. May partially pass the SEO value of the original URL to the new location.
Browsers support Mostly universal support in all browsers Universally supported in all browsers Universally supported in all browsers Universally supported in all browsers

When to use a 308 Permanent Redirect

The 308 permanent redirect status code ensures that search engines and clients memorize the new target resource location and that their redirected requests utilize the same HTTP method used in the original request. These characteristics make the 308 status code particularly useful in some specific scenarios.

Preserving Requests Integrity

A 308 permanent redirect can be useful if your website’s structure changes. For example, moving a resource from one path to a new permanent URI (e.g., from /old-directory/ to /new-directory/). Implementing 308 redirects can automatically re-link references to the moved resources, ensuring that users and search engines are permanently directed to the new URLs.

Migrating to a New Domain

When moving your site to a new domain and redirecting traffic from the old one, you’ll want to ensure that any POST requests, like those made by AJAX calls or web service endpoints, are not converted to GET requests. A 308 redirect preserves the method across domains.

Form Submission

You have a form to which clients submit data, and you’ve moved it to a new URL. A 308 redirect ensures the user keeps using the POST method even after being redirected to the new location. This is crucial for maintaining the functionality and security of the form submissions during and after the transition.

Enforcing Consistent Endpoints

Many services require your website to maintain consistent endpoints, e.g., a RESTful service where the endpoint’s method represents a specific action. You can use a 308 HTTP response code to permanently redirect the effective request URI to the correct resource without the risk of changing the method.

How to Set a 308 Permanent Redirect

Using .htaccess

You can set a 308 permanent redirect through your website’s .htaccess file, which governs the behavior of your web server.

Follow the steps below to learn how.

  1. Access your website’s root folder through your website’s File Manager in your hosting’s control panel or through an FTP client. Most commonly, the root folder is:
    yourdomain.com/public_html
    Website root folder containing .htaccess
  2. Find and open the .htaccess file with the File Manager. If you use an FTP client and can’t edit files, download the .htaccess file on your local computer and edit it with a text editor.
    Edit .htaccess to set a 308 redirect
  3. Determine what exactly the 308 permanent redirect should do and use the appropriate .htaccess command. Below, you’ll find a few examples of different 308 redirects.
    # Redirect a single page
    Redirect 308 /old-page.html http://www.example.com/new-page.html
    # Redirect an entire directory
    Redirect 308 /old-directory/ http://www.example.com/new-directory/
    # Redirect an entire site to a new domain
    Redirect 308 / http://www.newdomain.com/
    # Redirect with wildcard, requires mod_rewrite
    RewriteEngine On
    RewriteRule ^old-directory/(.*)$ http://www.example.com/new-directory/$1 [R=308,L]
    # Redirect while preserving the query string
    RewriteEngine On
    RewriteCond %{QUERY_STRING} .
    RewriteRule ^old-page.html$ http://www.example.com/new-page.html?%{QUERY_STRING} [R=308,L]
    # Redirect an entire site to a new domain while preserving the URI
    RewriteEngine On
    RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=308,L]
  4. Write the 308 redirect command in the .htaccess file and save it. If you edit the file on your local computer, re-upload it through FTP into your website’s root folder.

    NOTE! Place the 308 redirect command at the top of the .htaccess file to ensure its execution. The web server reads the file top-down, so other commands may prevent the redirect if they precede it.

    308 Permanent Redirect in .htaccess

Using NGINX

Another popular web server type that many hosting employ is NGINX. If you have permission to modify its settings, you can add a 308 redirect command to your website’s NGINX configuration file.

You can find the step-by-step instructions below.

  1. Open the folder containing the configuration files for your websites. The standard location is:
    /etc/nginx/sites-available/
  2. Open your website’s configuration file. Typically, the file is named after the domain name. For example, if the domain is mydomain.com, the configuration file is also named mydomain.com.
  3. Find the server block, a section of the configuration file, and place the 308 redirect command inside. The following example can serve as a template for your own redirect:
    location /old-page.html {
        return 308 http://www.example.com/new-page.html;

    Replace old-page.html with your old resource location and http://www.example.com/new-page.html with the new permanent URL location.

Here is how the redirect looks inside the server block.

308 Permanent Redirect in NGINX configuration file

Using WordPress Plugins

If your website is WordPress-based, you may have a more accessible option to set a 308 URL redirection. There are plenty of plugins with the option to set a 308 permanent redirect.

For this example, we will take the free Redirection plugin.

  1. Log into your WordPress dashboard and go to Plugins > Add New Plugin.
  2. In the search bar, type redirection.
    Search results for the Redirection plugin in the Plugins section in WordPress
  3. The Redirection plugin will pop up as one of the first results. Click on the Install Now button.
    Installation of the Redirection plugin in WordPress
  4. Once the plugin is installed, Install Now will be replaced by an Activate button. Click on it to activate the plugin.
    Activation of the Redirection plugin
  5. Navigate to Tools > Redirection.
  6. Type the old URL in the Source URL field.
  7. Type the new location in the Target URL field.
  8. Click on the Show advanced options icon (cog wheel).

    Setting a 308 redirect in the Redirection plugin in WordPress

  9. Open the drop-down menu with HTTP code and select 308 – Permanent Redirect.
  10. Confirm the redirect with the button Add Redirect.
    Confirming a 308 Permanent Redirect in the Redirection plugin in WordPress

308 Status Code Effects on SEO

Redirecting resources from one location to another always raises concerns about the effects on the SEO (Search Engine Optimization) score. Search engines can be unforgiving if the redirects are not appropriately handled. However, if carefully executed, the 308 permanent redirects are generally harmless.

Here are some key points of the 308 status code effects on SEO.

  • Preserves ranking signals – The 308 redirect is designed to preserve the HTTP method used in the original request. This is beneficial for SEO as it instructs search engines to transfer all ranking signals, such as link equity and page authority, to the new URL.
  • Reduces confusion for search engines – The 308 status code reduces the potential for search engines to misinterpret the intent of the redirect since it instructs them that the redirect is permanent and they should preserve the original HTTP method. which can help maintain SEO performance.
  • Improves user experience – By maintaining the original HTTP method, the 308 response code ensures that visitors won’t encounter unexpected behavior on the page they are being redirected to. Thus, it helps maintain user experience, a vital part of SEO.
  • Requires proper implementation – To fully benefit from the SEO advantages of a 308 redirect, it must be incorporated correctly. Incorrect implementation can lead to issues like redirect loops or pages not being indexed properly, hurting your website’s score.
  • Not as widely recognized – While supported by most modern browsers, the 308 response code is not as widely recognized as the 301 status code. You should research if the search engines and the preferred browsers of your target audience support this redirect type.

Summary

The 308 status code is a powerful tool that allows you to relocate and restructure your web page resources while maintaining the original location’s user experience and link juice.

However, using the 308 redirect warrants attention and diligence. Incorrectly implementing it can seriously harm your website’s performance and traffic. Thus, understanding how the 308 status code works and how to set it up is instrumental in effectively redirecting visitors to your website’s new location.

Share This Article