Skip to content
Domains and DNS2 min read

What is a 301 redirect?

Short answer

A 301 redirect is a server response telling browsers and search engines that a page has permanently moved to a new address. Visitors are sent there automatically, and search engines transfer the old page's ranking signals to the new URL.

ArabyHost teamLast updated: ShareWhatsAppXLinkedIn
Contents
  1. How it works
  2. Practical .htaccess examples
  3. Common mistakes
  4. On ArabyHost

When you change a page’s URL or move to a new domain, the old links live on in search results, social posts and other sites. Without a redirect, visitors hit a 404 error and the page loses its rankings. A 301 solves both problems: it sends visitors to the right place and tells search engines the new address.

How it works

The server answers a request for the old page with the status code 301 and the new address in the Location header:

HTTP/1.1 301 Moved Permanently
Location: https://example.com/new-page/
Code Type Use
301 Permanent Changed URL, domain move, forcing HTTPS
302 Temporary Maintenance or a short promotion
307 Temporary, keeps the request method Temporarily redirecting POST forms
308 Permanent, keeps the request method APIs

Practical .htaccess examples

Redirect one page:

Redirect 301 /old-page/ https://example.com/new-page/

Redirect a whole old domain to a new one, keeping the path:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?old-site\.com$ [NC]
RewriteRule ^(.*)$ https://new-site.com/$1 [R=301,L]

Put these rules in the .htaccess file in the site’s root folder, or generate them with the .htaccess redirect generator.

Common mistakes

  • Redirect chains: http to www to https. One direct hop to the final URL is better.
  • Redirect loops: two rules redirect to each other and you get ERR_TOO_MANY_REDIRECTS.
  • Sending every page to the homepage: search engines may treat it as a missing page. Redirect each page to its closest match.
  • Using 302 by accident: some plugins default to 302, so check the code.

On ArabyHost

The LiteSpeed web server on ArabyHost reads .htaccess rules in the same syntax used with Apache, so the examples above work as they are. You can also create redirects from the Redirects section in cPanel, opened with one click from the Araby Panel. To force HTTPS once your free SSL certificate is issued, see the force HTTPS guide.

FAQ

What's the difference between a 301 and a 302 redirect?

A 301 is permanent and search engines use it to update the address in their results; a 302 is temporary and keeps the old address indexed. Use 302 only for temporary cases like maintenance or promotions.

How long should I keep a 301 redirect?

As long as you can, and at least a year after a site move, because old links on other sites may keep pointing to the old address.

Why doesn't my browser show the updated redirect?

Browsers cache 301 redirects. Try a private window or clear the browser cache after changing the rule.

Useful? Share it with someone who needs it:WhatsAppXLinkedIn

Read next

Ready to put your idea online?

Fast, isolated hosting, support that understands you, and an AI assistant that fixes problems with you.