What Is a 301 Redirect? How To Do a 301 Redirect on 3 Common Servers + WordPress
A 301 redirect is a best practice in SEO. It preserves a good user experience for both search engines and website visitors when trying to access a file on a website.
But what exactly is a 301 redirect, and how do you implement it? In this article, I’ll discuss what a 301 redirect is and how to do it on three different types of servers plus WordPress sites.
In this article:
Benefits of Using 301 Redirects
Maintaining Search Engine Rankings
How to Do a 301 Redirect on Apache, NGINX and Microsoft IIS
Implementing a 301 Redirect in Apache .htaccess Files
301 Redirecting a Page in Apache
301 Redirecting an Entire Domain in Apache
Implementing a 301 Redirect on an NGINX Server
Implementing a 301 Redirect on a Microsoft IIS Server
How to Do a 301 Redirect on WordPress
Common Mistakes to Avoid with 301 Redirects
Redirecting to Irrelevant Pages
Using 302s Instead of 301 Redirects
Best Practices for 301 Redirects
Monitoring and Testing Redirects
What Is a 301 Redirect?
You’ve probably heard about 301 redirects. But what exactly are they and why do they matter so much? Let’s break it down.
Definition of 301 Redirect
A 301 redirect is an HTTP status code that signals a permanent redirect from one URL to another.
In simple terms, it tells search engines that a page has permanently moved to a new location and quickly ushers website visitors to the new URL.
When a user or search engine bot tries to access the old URL, they’re automatically forwarded to the new one. This happens so quickly that most people don’t even notice the change.
Note that some modern servers and frameworks also support HTTP 308 redirects, which function similarly to 301 redirects but preserve the original request method.
While 301 redirects remain the most commonly used option for SEO, you may encounter 308 redirects in newer web applications and APIs.
How 301 Redirects Work
So how does this all work behind the scenes? When a server receives a request for a URL that’s been 301 redirected, it responds with the 301 status code and the new URL location.
The browser or search engine bot then makes a new request to the new URL, and voila — the user ends up on the right page.
When to Use 301 Redirects
There are a few key situations where you’ll want to use a 301 redirect:
- If you’ve permanently moved a page to a new URL.
- If you’re merging two websites and want to consolidate content.
- If you’ve changed your site’s domain name or structure.
Basically, any time a page’s location has changed for good, a 301 redirect should be implemented.
For large site migrations, create a redirect mapping document that pairs every important old URL with its new destination. This helps preserve rankings, backlinks and user experience during the transition.
Benefits of Using 301 Redirects
Now that we know what 301 redirects are and when to use them, let’s discuss why they’re so important. Implementing 301 redirects correctly can benefit SEO and user experience.
Preserving Link Equity
One of the biggest advantages of using 301 redirects is that they help preserve your site’s link equity. When another site links to your content, it passes along some of its authority and ranking power.
If you move that content without a 301 redirect, all of that valuable link equity is lost.
But with a proper redirect in place, search engines understand that the page has moved and credit the new URL with the existing backlinks and authority.
Improving User Experience
301 redirects also play a key role in creating a smooth user experience. Visitors clicking on an old link could get a 404 error page without them.
And if you don’t have a custom 404 page that guides them elsewhere on the site, you’ll probably lose a visitor.
But with a redirect, they’re seamlessly sent to the new location of the content they wanted. There is no confusion, no frustration, just a quick and easy path to the information they need.
Maintaining Search Engine Rankings
Lastly, 301 redirects help maintain your search engine rankings when content moves. If you don’t use a redirect, search engines may see the old URL as a 404 error and remove it from the index, costing you valuable organic traffic.
By implementing a 301, you signal to Google and other search engines that the page has permanently moved.
How to Do a 301 Redirect on Apache, NGINX and Microsoft IIS
OK, now onto the subject of how to do a 301 redirect.
First, a word of warning: Be careful when making the changes. One small mistake in a server configuration file like .htaccess can take your site offline until the mistake is fixed.
Implementing a 301 Redirect in Apache .htaccess Files
To implement a 301 redirect on an Apache server, you modify the .htaccess file, which allows changes per directory.
The examples below use Apache’s mod_alias directives, which are often simpler than mod_rewrite rules for straightforward redirects.
This file controls that directory and all the subdirectories in it. Modifying the .htaccess file doesn’t require administrative rights.
Follow these initial steps to get started:
- The first step in doing a 301 redirect is to have the old URL and the new URL handy.
- Log on to your website and find the .htaccess file in the root web folder.
- Open the .htaccess file by using a text editor like Notepad++.
- Edit the file using the examples that follow.
301 Redirecting a Page in Apache
When you are ready to 301 redirect a page in Apache, add a line to the .htaccess file that tells the server what to do. There are two ways you can do this:
Example 1:
RedirectPermanent /old-file.html https://www.mydomain.com/new-file.html
Example 2:
Redirect 301 /old-file.html https://www.mydomain.com/new-file.html
There are essentially three parts to this:
- The first part is the RedirectPermanent or Redirect 301, which tells the server what to do.
- Then, you tell the server the old file’s relative path. If the file is in your root web directory, you can use the file path without the domain name.
- The third part is the full path to the new file.
Save the file and test the redirect carefully before deploying changes to production.
301 Redirecting an Entire Domain in Apache
Add a line to the .htaccess file to tell the server what to do. A redirection from one domain to another would look like this:
RedirectPermanent / https://www.new-domain.com/
Implementing a 301 Redirect on an NGINX Server
Implementing a 301 redirect on an NGINX server is similar to doing so on an Apache server (in other words, it’s fairly straightforward).
You’ll modify the configuration file, and you need admin privileges to do so.
Typically, this file is located in the directory: /usr/local/nginx/conf, /etc/nginx or /usr/local/etc/nginx
But not always. The file could also be somewhere else. The best thing to do is to use the command “nginx -t” to find where it is, like this:
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
For simple redirects in NGINX, many administrators prefer the return 301 directive because it is simpler and more efficient than using rewrite rules. For example:
location /old-page {
return 301 https://www.example.com/new-page;
}
For more advanced redirects involving patterns or entire folders, you can use a rewrite rule like the following:
rewrite ^/category/something/(.*)$ https://www.example.com/something-else/$1 permanent;
At this point, I want to stress that this specific mod rewrite is for redirecting a specific folder URL (the entire folder) to another URL.
The little asterisk (.*) is a wildcard symbol, so that means that any path after the forward slash in the first URL will be redirected and used in the second URL ($1).
This redirect basically says the following: “if you have a category named something, then redirect it and anything underneath it to another folder with the name of something-else.”
Implementing a 301 Redirect on a Microsoft IIS Server
Implementing a 301 redirect on a Microsoft IIS server is a bit more complex than on other servers.
You will most likely need admin rights to do a 301 redirect, and you need to ensure that the HTTP Redirection Feature is installed. You can do this in Server Manager, under Manage > Add Roles and Features.
To implement a 301 redirect:
- Open the internet services manager (Start > All > Windows Tools > Internet Information Services (IIS) Manager, or search for IIS Manager in the Start Menu).
- In the left column, select the site, folder or page you want to redirect. If you cannot see the thing you want to redirect, you can select the site, then click on the “Content View” tab to show the contents of the folder to select the file you want to redirect. After selecting the file or folder, you can click on “Features View” again.
3. In the center panel, using the Features View tab, find the “HTTP Redirect” icon and double-click.
4. Select “Redirect requests to this destination” then type the URL you want to redirect.
- Redirect to a single page:
www.mydomain.com/newpage.htm - Redirect to a directory:
www.mydomain.com/newdirectory - Redirect to a domain:
www.mydomain.com
5. If keeping the directory structure and page names the same, ensure the two checkboxes below “redirect options” are unselected. Here is some context for the two options you will see:
- “Redirect all requests to exact destination:” Choose this if you want every file in the directory or domain you’re redirecting from to be routed to a single page. One situation where you would want to do this is if you are combining groups of directories into one separate site devoted to a specific topic, rather than have that topic on your site. In which case, you would not want all that content on the other site showing up on this existing site as duplicate content. So these content pages and files would need to be pruned and redirected accordingly. Another situation is if you had a hacked directory that wasn’t applied to the entire site, and you no longer want people to go to that directory. You could technically rename that directory, and redirect all files to a specific page. With additional work, this could effectively rebuild that directory.
- “Only redirect requests to content in this directory;” Choose this if you want to redirect only the files located in the selected directory, not subdirectories. One situation where you would want to do this is if you have performed a content audit and found pages that you want to prune from your overall content profile. You would want to eliminate and redirect pages within a category to the main category page.
6. For “Status code,” choose “Permanent (301).”
7. In the menu on the right column, choose “Apply.”
How to Do a 301 Redirect on WordPress
If your site runs on WordPress, you’re in luck — there are several handy plugins that make setting up 301 redirects a breeze. Some popular options include:
- Redirection.
- Yoast SEO.
- Simple 301 Redirects.
- Quick Page/Post Redirect Plugin.
- Rank Math.
With these plugins, you can easily create and manage redirects right from your WordPress dashboard, without messing with any code.
Just enter the old URL, the new URL, hit save and you’re good to go.
Note that for large websites or complex migrations, server-level redirects are generally more scalable and performant than relying entirely on plugins.
Common Mistakes to Avoid with 301 Redirects
When implementing 301 redirects, a few common pitfalls can lead to issues later on. So, let’s dive into some of the most frequent mistakes and how to avoid them.
Redirect Chains
First, we have the redirect chain. This happens when a series of redirects point to each other, creating a long chain of hops before finally reaching the destination page.
Not only does this slow down the user experience, but it can also dilute the link equity you’re trying to pass along. Search engines might even give up trying to follow the chain altogether.
Redirect Loops
Next, we have redirect loops. This is when you accidentally create a circular path of redirects, sending users and search engine bots into an infinite loop of frustration.
It’s crucial to double-check your redirects to ensure they’re all pointing in the right direction.
Redirecting to Irrelevant Pages
Another common mistake is redirecting users to completely irrelevant pages. This is a surefire way to annoy your visitors and increase bounce rates.
Always take the time to map out your redirects and ensure that users are sent to the most relevant page possible. It’s worth the extra effort.
As a final note on this, avoid redirecting large groups of unrelated URLs to the homepage. Search engines may treat these as soft 404s if the destination is not meaningfully related to the original content.
Using 302s Instead of 301 Redirects
It is important to make sure that you’re using the redirect type that is relevant for your use case.
If you’re only making temporary changes, you have to make sure that these changes are followed up by removing the redirect as soon as possible once Google has crawled and indexed the new versions of your pages.
If the redirect is of a permanent nature, always use the 301 redirect instead of the 302.
While Google can pass ranking signals through many redirect types today, using the correct redirect type still matters. A 301 or 308 redirect clearly signals a permanent move, while a 302 or 307 indicates a temporary change.
Best Practices for 301 Redirects
Now that we’ve covered some of the most common mistakes to avoid with 301 redirects, let’s talk about best practices.
Here are a few key tips to keep in mind:
Updating Internal Links
One often overlooked aspect of implementing redirects is updating your internal links.
If you’ve moved a page and set up a 301 redirect, that’s great. But don’t forget to also update any internal links on your site that point to the old URL.
This helps site visitors and search engine bots navigate your site more efficiently, without running into unnecessary redirects.
It’s a small step that can make a big difference in your site’s overall performance.
Monitoring and Testing Redirects
Another key best practice is regularly monitoring and testing your redirects. Just because you set them up once doesn’t mean you can set it and forget it.
I recommend using tools like Screaming Frog or Google Search Console to monitor your redirects and ensure they’re all working as intended.
You can also test redirects manually using browser developer tools, online redirect header checkers or command-line tools like curl. For example:
curl -I https://example.com/old-page
This command returns the HTTP response headers so you can verify that the page is returning the correct redirect status code and destination URL.
You’d be surprised how often redirect issues can crop up over time, especially if you frequently change your site’s structure or content.
If you use a CDN or reverse proxy like Cloudflare, redirect behavior may also be configured or cached outside the origin server.
In these cases, you may need to clear caches or review CDN-level redirect rules when troubleshooting issues
Keeping URLs Simple and Relevant
Finally, when you’re setting up new URLs for your redirected pages, it’s important to keep them simple, relevant and descriptive.
Avoid using complex structures or unnecessary parameters that could cause problems down the line.
Remember, your URLs are important for user experience and your site’s overall SEO.
When you keep them clean and descriptive, you’ll make it easier for both users and search engines to understand what your pages are about.
Final Thoughts
301 redirects may seem like a small, technical detail, but they are crucial in keeping the web running smoothly.
Understanding when and how to use them helps ensure that your site visitors always find what they’re looking for, even if things move around behind the scenes.
With these best practices in your toolkit, you’ll be sure to create a great user experience on any website.
FAQ: How can I use a 301 redirect to manage permanent URL changes on my website?
A 301 redirect is the standard method for permanently moving a webpage from one URL to another.
When implemented correctly, it automatically sends users and search engines from the old URL to the new one, helping preserve traffic, maintain search visibility and prevent 404 errors.
A 301 redirect differs from a 302 redirect, which indicates that a move is temporary.
While a 301 signals that search engines should update their index to the new URL, a 302 typically tells them to continue treating the original URL as the primary destination.
Proper 301 redirect management is important because it:
- Preserves user access to content after URL changes.
- Helps maintain organic search performance during site updates and migrations.
- Consolidates ranking signals from existing backlinks.
- Prevents broken links and unnecessary 404 errors.
- Improves the overall user experience.
301 redirects are commonly used during website migrations, domain changes, content consolidation and URL structure updates.
However, poorly managed redirects can create issues such as redirect chains, redirect loops and slower page loads.
Best practices for managing 301 redirects include:
- Use 301 redirects only for permanent URL changes.
- Redirect each old URL directly to its most relevant new destination.
- Avoid redirect chains by limiting redirects to a single hop whenever possible.
- Maintain a documented redirect map for site updates and migrations.
- Regularly monitor 404 errors and fix broken links.
- Keep redirects in place as long as users, backlinks or search engines may still access the old URLs.
- Audit redirects periodically to identify outdated or unnecessary rules.
Action Plan: Implementing 301 Redirects
- Identify the URLs that need to be redirected.
- Map each old URL to the most relevant new URL.
- Configure the redirect within your CMS, server or redirect management platform.
- Verify that each redirect returns a 301 Moved Permanently status code.
- Test redirects to confirm they resolve correctly and do not create loops or chains.
- Monitor analytics and search performance after implementation.
- Review redirects regularly, especially after major website updates.
Tools such as Redirect Path can help validate redirect status codes and identify redirect chains, loops and broken URLs.
301 redirects are a critical part of technical SEO and website maintenance. A well-planned redirect strategy helps users find the content they need, preserves valuable search visibility and supports a smooth experience during website changes or migrations.
26,000+ professionals, marketers and SEOs read the Bruce Clay Blog
Subscribe now for free to get:
- Expert SEO insights from the "Father of SEO."
- Proven SEO strategies to optimize website performance.
- SEO advice to earn more website traffic, higher search ranking and increased revenue.
92 Replies to “What Is a 301 Redirect? How To Do a 301 Redirect on 3 Common Servers + WordPress”
I really loved your blog. It helped me understand the 301 redirection quite easily. Thanks. Looking forward to more such blogs.
How about if we do a redirect on Domain server level – i.e. like if you check Godaddy they give you option do you want to move domain (old URL) to a new URL.
Amazing article, very helpful and informative. Thanks for sharing it.
Extremely helpful. Thank you for sharing this information I will surely apply it on my website.
Very nice explaination about 301 redirection. You have nicely explained about implementation of 301 redirect.
Very informative. This blog helps us to make a better understanding of how can we redirect 301.
Hi,
It counts as a 302 redirect.
With a 200 OK on both the start and target page, the search engine index both the start page and the target page.
Since this method is a known spam method, it is best to avoid it.
I’m not sure what you’re asking here. If you don’t want a file to be indexed, then yes, use the robots.txt file to exclude it.
This defines index-d.html as being the first page that the server looks for on a directory request. If it can’t find that page, then it will go to index.html and so on.
I have a question about 301 permanent redirect and your advice will be great. I have an website about snoring and on that website are 2 related articles, 1 of them ranks for a lot of kws position 2-10 ( article A) and the other one just for 4-5 kws position 1-3 (article B). Both articles are on first google page and I want to permanent redirect the article B to A. Also on my website are some articles that point to article B and I want them to point to article A using same anchor texts. Now my question: Does this changes will pass the juice to article B to A and it will increase the article A rankings? And if I do this changes should I delete article B and reuse the content on other websites? Thank you very much for your time I will wait your answer, please excuse my bad english.
Susan: There are no guarantees, but your plan seems basically sound. The 301 will preserve existing link equity. But consider whether the two pages are currently acting as support pages for each other (linked and with unique but closely related content). If so, they form a sort of mini-silo, and the surviving page’s rankings might suffer if you remove its support page. Also, any time you want to remove a page that is ranking, try to make sure that the page you’re redirecting it to can answer the same questions. I hope that helps.
This blog really helped me out in placing redirect 301 on its place. Everything has been explained really well.
Very informative. this blog helps us to make a better understanding of how can we redirect 301 . thanks for the post.
Awesome easy guide ! A newbie can understand that very well .Thanks for the post !
301 redirects have a lot of uses when it comes to SEO. Use them strategically and you could see huge gains in organic traffic. However, it pays to make sure there are no existing problems with 301 redirects on your website first, as these could be hindering your current and future SEO efforts.
How to do a 301 Redirect is really most important when you don’t want to lose your website traffic. Really appreciate your efforts in writing this and sharing with us.
I really appreciate your efforts in writing and explaining the implementation of 301 redirect. It is really helpful for all the SEO experts.
301 and 302 re best SEO practices. whenever we want to temporary down a page we need to use 302 redirects. If you use these redirects in a wrong way then you can loss your website seo, so always make sure and double check when using these redirects.
How about if we do a redirect on Domain server level – i.e. like if you check Namecheap they give you option do you want to move domain (old URL) to a new URL
Drone Master: If you do a redirect on the server level like the example given with Namecheap, then you will use their tools to set it up and the host (Namecheap) will do this for you. Typically, they redirect ALL URLs to the new site, so if you want some customization then this probably isn’t the best way to go.
Thanks, I had no idea how a 301 was done on a windows server :) Always done in .htacces, the first time I had a Windows server I didn’t know how to insert the rules :)
Thx Bruce,
For last couple of days I was having difficulty for 301 Redirect code.
You gave many examples and thx to all those made comments.
It really bugs me that I have let so much good juice go to watse by not properly editing the 301 re-directs. But at least now I have a good grasp of what is required – thanks for this – even if I was a little late in picking it up!@
Grateful,
Dan
This is a great post. Properly 301 redirecting is very important. Especially in 2016.
I would like to move one language version (in this case english version) of the multilingual site to the new domain but, on the new domain would like to use different URLs for some old pages.
Is it possible to do it like that and what would be the step by step guide?
Best regards in advance for a help.
Hey Virginia,
Wow! apart from redirection, I was looking into LocaliseJS or something – which was obviously prooving to be too expensive!
Had never considered the hreflang option, as I wasn’t even aware of it!
Thanks for the helpful suggestion :)
Cheers!
Local searches will include keywords and phrases that relate to the businesses within their neighborhood,
I would like to say 301 redirection can seems like a bit of a “double-edged” knife. It does sometimes take a while for the search engines to attribute your new page with the search authority of your original page. All depends on how often your new redirected page is crawled by any search engines. Moreover, it takes too much time if you have many pages. Why not just simply by adding rel canonical attribute instead of 301 redirection?
Great article. Gonna use this as a good resource page to the challenge I’m facing.
Currently I’m doing SEO for a company that wants to rank in multiple countries. To ensure that they’ve a better user experience, they’ve hired translators to re-write their content for each individual country in their native language.
But this has created a complexity for SEO on the website as they’ve multiple URLs, with varying languages, for the same product.
So the amount of SEO that needs to be done has been multiplied.
I was looking at what could be done in a case like this, and thought that redesigning the website would be the best way to go. And redesigning it, and at the same time, doing a 301 redirect to a single page, from all the separate country/language pages.
However, it is a compromise from providing a better UX, because of the local language factor – especially in places like Russia and Japan (as told by the client).
Hi Apurv. Multi-language sites do have many levels of complexity! I’m pretty sure redirection is NOT what you need, however. Look into hreflang. Here’s where you can start: https://support.google.com/webmasters/answer/189077?hl=en
I don’t use 301 redirects but after reading this article I already have a plan.This is a great article. As always, chock full of great info and visuals. Thanks!
Good and easy to use, but the modern site owners choose a CMS that makes easier the 301 redirect, like WordPress with many plugins.
Great article I’ve always struggled with the proper way to do a 301 redirect, nice to have this resource hand thanks!
Great guide. I have to implement 301 on my site which too many 404 pages. I hosted on a windows server and now I want to do 301 HTML meta redirect. What is the best method to redirect 900+ pages using HTML redirect? And How to implement the same? Thank you.
Hi Great Post. I´ve made a huge analysis of my website and decided to start a 301 redirect project. I´ve catalogue all pages that need to change permalinks , for SEO strategy,and implemented the redirects.
In fact i´ve used a wordpress plugin called “Redirection” that manages modification pages and 404 erros too. After the whole redirection work , i sent a new sitemap to Google, and excluded the old one from Google webmaster tool.
Now, after 20 days i can see that my new pages are indexed but the old ones are still there too, resulting in a lot of duplicate titles and contents in Google Webmaster Tool HTML Improvement report
How to prevent that? or fix it?
Hi Leo, thanks for your question. Our recommendation (hat tip BCI Director of Software Development, Aaron Landerkin) is to follow these steps:
1. Verify that those redirects from the old URLs are actually 301s using a server header checker. (Here’s our free tool that does this http://www.seotoolset.com/tools/free-tools/#check-server-page.) 302s and other methods of redirection won’t remove the old URLs. The plugin you mentioned allows you to do multiple types of redirects, so we want to make sure they are correct. If they aren’t 301s, fix the redirects so that they are 301s.
2. If the redirects are all 301 redirects, you can try submitting the old URLs back into Google so that they’ll crawl the 301. It could be that the crawl budget for the site is low, and Google may be taking its sweet time getting to all the old and the new pages – it has to crawl both, not just the new ones. Eventually, the old pages will drop out; resubmitting the old URLs may just help that process go faster.
If you give this a try, let us know how it goes!
With WordPress, YOAST which is the most popularly used SEO plugin now includes redirect functionality that makes it super easy. You can also do this through your cPanel but hats off to anyone that can do complex redirects using regex.
Thanks so much for detailed article on redirects.
“As long as everything is done correctly, a 301 redirect will ensure that you keep the rankings earned by the old page and prevent duplicate content that could arise if the engines were to index both versions of your site.” This is so true.
Having applied it to a few sites it has helped to flow over all the benefits from previous sites no longer live.
Wonderful explanations. Possibly another point to cover here would have been doing redirects in WordPress … Mainly because it is one of the most used today. For any that are seeking info on that … Most seo plugins do allow for this in WP. If the one you use does not just look for a redirect plugin and be sure to use 301 redirects for permanent redirects (they are the kind that matter for seo).
Problem solved. Thxs to https://gist.github.com/HechtMediaArts/cbea1b62d4f7b8b0f337.
You have to do a rewrite:
RewriteEngine on
Redirect 301 /xyz.com/blog/ http://xyz.com/blog.html
Simple htaccess redirect is not sufficient.
Thank you Christi,
to put it into more detail: let´s say example.com, points a link to your site xyz.com. That is a backlink that xyz.com get from example.com.
xyc.com used to use worpress, or php but decided implement a design change and go with html. so what would be the redirect code from the xyc.com/page1/ to xyc.com/page1.html.
Note that the redirect should be working from xyc.com/page1/ (this exact path).
Sandra
There is plenty of information 301 redirects and on how to set them up for your website.
Most of the answers deal with the redirects between the same files paths.
There is less information on how to redirect backlinks properly that point to your domain, but to a different url structure and different file paths, file extensions.
Please share your experience.
One frequent question was: How do I redirect backlinks that from a WordPress or php site to an HTML site (same domain !!). This issues occurs when you change design on a website.
Thanking you in advance for your contributions.
Hi Sandra,
Well, you can’t redirect backlinks, since they are controlled by external domains that you don’t control. A 301 redirect from “Page A” to “Page B” instructs search engines take the known backlinks to “Page A” and reattribute them to “Page B.”
Hope that helps!
Kristi
Hi Bruce,
Thank you for the wonderful article.
How to fix .htm 404 errors? Any help would be greatly appreciated.
These are different status codes. Each one has a different meaning. 301 means a permanent redirect, while a 302 means that the document for the requested URL was found at another URL. Hope that helps!
Kristi
Great insight about 301 redirection. You have nicely explained about implementation of 301 redirect.
Keep Posting.
Great read! Very informative and detailed article. Very useful when having some site revamps.
Hi,
I am bringing in in a new website and plan on setting up 301 redirects in the .htaccess file.
Do I need to keep the OLD .html pages on the server?
the .htaccess file always gives me fits. This helps. Although I usually have help with stuff like this. But I think with this guide I can now do it myself!
It’s fantastic that have referred to a topic that rarely discusses. 404 errors are one of the worst obstacles to their search engine rankings and are not taken well by the SE. You need to have a proper 301 redirect procedure in place, especially if you constantly add and remove pages from your website.
Great guide, really good described. I have just implemented it on my site which runs on apache box and it worked. better safe than sorry and not get kicked out because of dublicate content :)
Thanks for the clarification on this issue. It seems to be something that isn’t going to go away and we need to make sure we address it.
If you ever have trouble trying to do a redirect and set a cookie as part of the same response, if your using IIS 5.0, the problem might be caused by an IIS bug.
http://support.microsoft.com/default.aspx?scid=KB;en-us;q176113
It seems as if IIS filters out the cookies. If you are trying to redirect to an application server, you might try redirecting directly instead of going through the web server.
It’s great that you have touched upon a subject that is rarely discussed about. 404 errors are one of the worst impediments to your search engine rankings and are not taken well by SEs. You need to have a proper 301 redirect procedure in place, especially if you constantly add and remove pages to your website.
If I want to redirect a one domain to another, is there a difference between a 301 redirect and a permanent redirect? or are they the same thing?
Wow, this is the most informative article and string of comments I’ve found in about 3 weeks of searching. I have an old site created by someone else that I am taking down but want to do a basic/minimal hosting to redirect the domain (which I own) and pages to the new site. Old site has .asp pages. New site used a site builder that won’t allow me the various folders, sub-folders and long page name structure of old site. I understand how to redirect the old pages to the new corresponding but slightly mis-matched page names with an asp redirect. My problem is I don’t have IIS access and don’t know how to redirect the domain itself (there are links out there that I’m trying to change over but that takes time) without IIS access. My instruction on asp redirect says insert code and save as oldpagename.asp. But my domain isn’t a page name. Any advice? First I tried to set up hosing for the old domain on Linux and do .htaccess and that works for the domain, but with the asp pages it doesn’t so I need to switch it to Windows. Is there a Windows-compatible file, like an .htaccess, that I can use for the domain? Thank you.
Great article! What if i don’t have IIS admin access and only using .htm pages?
what should i do?
We are incorporating a 301 redirect in our dev/uat environment before we move this to production as a proof of concept. This environment is not accessible via the DMZ therefore I cannot test accuracy to ensure the 301 header is displaying correctly via the many tests that are offered out there by inserting the domain into a textbox and returning a "http / https Header Check". Are there any ways I can test this internally?
Can you pls respond.
Thank you
Jim Glockner
Webmaster Deluxe Corporation
webmaster@deluxe.com
jim.glockner@deluxe.com
I am not aware of an .htaccess file for use on an IIS server but there are native functions in IIS to do everything you need to do.
The limitations are scalability for a large site but if you cannot manage it at the server level you may have to consider doing it at the file level.
I am trying to get a nonwww to www redirect when people come to my site. How do I correctly get the ISS redirect to work. I went into ISS, followed ALL instructions and it still wont redirect my site to www if someone enters it without www. ANy ideas?
Hi maybe you can help
About 3 days ago i done a 301 direct from my old domain to new domain.
Both sites are now indexed with google for the same key phrases, how long before the old domain goes from index. or will they punish me for dup content.
Thanks
Hi Allison, I am not aware of an .htaccess file for use on an IIS server but there are native functions in IIS to do everything you need to do.
If you are running an apache server and you do not have access to the .htaccess file there is another method to redirect which is to code the redirect in the pages. The limitations are scalability for a large site but if you cannot manage it at the server level you may have to consider doing it at the file level.
There is a pretty compreshensive page on doing this with different scripts (java, vb, php) at http://www.somacon.com/p145.php
A couple questions:
1) I’ve heard about software that is coming out that allows you to implement an .htaccess file on an IIS server. Does anyone have more info on this or know where I could learn more about this?
2) You mention the following, “The ability to use .htaccess files will reside in a command called “Allow Override” in the Apache Configuration file.” How do I find the Apache Configuration file? Is it typically named the same thing and found in the root, or elsewhere? Can I find it if I have FTP access? And if I have my FTP client setup to view hidden files and I don’t see an .htaccess, is it always safe to upload one? I have a client who is on an Apache server, but I don’t see an .htaccess file. However, the site redirects to the home page if there is a 404 error. I thought the only way to do this on Apache was in the .htaccess but I can’t find the file. Is there something I’m missing?
Thanks!
Bruce clay: I did a 301 redirect, but I’m having some major issues. I was in the top 5 for website design and great traffic, I did the 301 about 1 week ago and now our traffic has dropped and no calls from google for like 1 week now. which I just did the 301 redirect 1 week ago
now my keyword is in positions 500-600 was number 4, how long does it take things to level out and get my traffic and rankings back? My headers tags are reading 301 and I implemented it correctly?
Hi,
It counts as a 302 redirect.
With a 200 OK on both the start and target page, the search engine index both the start page and the target page.
Since this method is a known spam method, it is best to avoid it.
Regards
Ranjana
Thx Bruce,
For last couple of days I was having difficulty for 301 Redirect code.
You gave many examples and thx to all those made comments.
Vijay
Thanks for the post. Is there any suggestion on how to handle a situation where a URL needs to be redirected to an “SEO friendly” one. TLD remains the same.
e.g:
Old URL: http://www.site.com/20/30/1123.html
corresponding new URL: http://www.site.com/coats/furcoats/longfurcoat.html
I would assume in the absence of 301 redirects, there will be 2 differently formatted URLs indexed and it’s unclear what the impact on the page rankings will be
Thanks.
ok, so let’s say you’re in the unfortunate situation where you’re unable to do either. you’re unable do htaccess or a 301 through windows server and you have to edit each page by hand.
what would you do to change the response code and then add it to the header? what would that code look like? is there an example for that?
i know i could google it, but i have done that before and the results that i found didn’t work correctly.
-thanks!
Nevermind, I’ve figured it out. I wrote a series of four conditionals in the .htaccess file that redirect appropriately based on what URL is requested.
Basically it just redirects all pages on the old domain to the new one AND redirects ‘non-www’ URLs to their ‘www’ counterparts.
I’ll put up my code for anyone to be able to dissect and use based on their requirements.
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^newSite.com [nc]
rewriterule ^(.*)$ http://www.newSite.com/$1 [r=301,nc]
rewritecond %{http_host} ^oldSite.com [nc]
rewriterule ^(.*)$ http://www.newSite.com/$1 [r=301,nc]
rewritecond %{http_host} ^www.oldSite.com [nc]
rewriterule ^(.*)$ http://www.newSite.com/$1 [r=301,nc]
rewritecond %{http_host} ^oldSite.com/ [nc]
rewriterule ^(.*)$ http://www.newSite.com/$1 [r=301,nc]
rewritecond %{http_host} ^www.oldSite.com/ [nc]
rewriterule ^(.*)$ http://www.newSite.com/$1 [r=301,nc]
*Note: the “/” behind any domain name on a condition line takes whatever page off of the domain name in the URL was requested and sends it to the page of the same filename on the new domain (I the “$1” variable asks the server to retain the filename from the request).
Thanks for the great article.
What if you’ve got to two servers on the same shared hosting?
e.g.
http://www.oldSite.com
http://www.newSite.com
and you want to
a)redirect non-www domain of the new domain to its ‘www’ counterpart (e.g. newSite.com -> http://www.newSite.com)
b)and redirect any requests to the http://www.oldSite.com domain to http://www.newSite.com
???
Is this possible even though both sites are working off of the same .htaccess file (because of the shared hosting situation)?
Can I modify each “.htm” file of the old site to point to its new counterpart (e.g. http://www.oldSite.com/page.htm -> http://www.newSite.com/page.htm) even though they are HTML files and not in PHP, ASP or Java?
Woah, Dave. Easy with the geek speak! You’ll hurt a girl with all those slashes, brackets and fancy words! I’m not going to lie, most of these questions were completely over my pretty little head, so I trotted myself down to our IT department, locked my favorite geek in a room, and fired them at him. Here’s what he had to say:
1. My guess is that they don’t have a problem with both of them being indexed in Google, thus creating duplicate content. I think when you are the search engine, you probably aren’t violating any guidelines.
2. If you are using Apache, then you can modify the .htaccess file on the site with the OLD URL to say:
RedirectPermanent /oldpage.asp http://www.newurl.com/newpage.asp
If you are using Windows Server, then you can browse to the file in the IIS Panel, right-click and hit properties. Instead of looking for the “Home Directory” tab, look for the “File” tab, and you can select the permanent redirection there.
Or, if you don’t have access to these things, you can place this ASP code at the VERY TOP of oldpage.asp:
3. Yes…kind of. If they are all redirecting to the same place, then the redirects above should work. If you want to redirect each one to a different place, it would be best to do a Mod Rewrite in Apache in order to 301 redirect them.
In IIS, it is MUCH harder where you would need to have different sites defined for www. and non-www. in your panel and redirect those. For IIS, it would be much faster, simpler, easier, etc. to put ASP code on the pages or use an ISAPI Rewrite Module to redirect each different variation to a different location.
4. Don’t use a redirect.
Instead, make index-d.html your default page that loads when http://www.coca-cola.com is requested. To do this in Apache, add this line to your
.htaccess:
DirectoryIndex index-d.html index.html index.htm
This defines index-d.html as being the first page that the server looks for on a directory request. If it can’t find that page, then it will go to index.html and so on.
On a Windows Server, go to IIS, right-click on the web site or the directory and click Properties. Once there, click on the “Documents” tab. Then make sure that “Enable Default Document” is checked and add your new filename into the list. Then, move the new document name to the top of the list.
5. I’m not sure what you’re asking here. If you don’t want a file to be indexed, then yes, use the robots.txt file to exclude it.
Great post!
So… Why does Google use a 302 redirect to go from: google.com – to – http://www.google.com?
Why doesn’t Google use a 301?
What if you want to redirect internal pages with a 301?
http://www.oldurl[dot]com/oldpage.asp – to – http://www.newurl[dot]com/newpage.asp (Easy enough)
But… What if there are several variations of the old URL caused by the URL prefix?
www & http:// & http://www & https:// – https://www – Would that require more than one redirect?
What sort of redirect should you use if you have a new content management system and need to go from something like: http://www.coca-cola[dot]com – to – http://www.coca-cola[dot]com/index-d.html
Should you use the robots.txt file to Disallow the URL with the extra characters via? http://www.coca-cola[dot]com/robots.txt
Aloha,
Dave.