Create permanent 301 redirect code for Apache, Nginx, IIS and other web servers. Preserve SEO value when moving content.
301 redirects are essential for maintaining SEO value when moving or restructuring content. They signal to search engines that a page has permanently moved to a new location.
301 redirects pass approximately 90-99% of link equity (PageRank) to the new URL.
Users are automatically directed to the correct page, reducing bounce rates.
Search engines understand the content has moved and update their indexes accordingly.
Important: While 301 redirects preserve most SEO value, it's always best to update links to point directly to the new URL whenever possible.
Add the following code to your .htaccess file:
Add the following code to your server block in nginx.conf:
Add the following code to your web.config file:
Add the following meta tag to the section of your HTML page:
Note: HTML meta refresh redirects are not considered true 301 redirects and don't pass full SEO value. They should only be used when server-side redirects are not possible.
A 301 redirect is a permanent redirect from one URL to another. It's the recommended method for redirecting web pages because it preserves search engine rankings and link equity better than other redirect types.
Use relative paths for same-domain redirects: Instead of https://example.com/new-page, use /new-page for better portability.
Redirect to the most relevant page: Don't just redirect all old pages to your homepage. Find the most relevant destination for each URL.
Test your redirects: Always test redirects after implementation to ensure they work correctly.
Update internal links: While 301 redirects work, it's better to update internal links to point directly to the new URLs.
A: Search engines typically recognize 301 redirects within a few days to a few weeks, depending on how frequently they crawl your site.
A: Yes, but minimally. A single 301 redirect typically adds 100-200ms to page loading time. Redirect chains should be avoided as they compound this delay.
A: No, for temporary moves you should use 302 (temporary) redirects. 301 redirects signal a permanent move to search engines.