How do I fix a 404 with a 301
-
I understand the need for fixing 404's but I have yet to have a serious walkthrough of how to set up a 301. From all the talk on the forums and such I'm pretty sure this is easy but I've just never done it before and I could really use a walk through.
Thanks
-
Hi Ben,
Did one of these responses answer your question for you? If not, also let us know if you're running anything like Wordpress or Drupal, and we can help give you more specific answers.
-
-
Hi Ben,
You probably want to redirect a single page if it is going to a 404. In which case you probably just want add code into the header of the problem page. Whilst you are at it, it might be worth checking that your non-www. pages are forwarding to the www versions. (http://exampledomain.com -> http://www.exampledomain.com)
PHP Redirect
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.exampledomain.com" );
?>Htaccess 301 Redirect (non-www. to www.)
Options +FollowSymLinks RewriteEngine On
RewriteBase / RewriteCond %{HTTP_HOST} !^www.exampledomain.com$ [NC] RewriteRule ^(.*)$ http://www.exampledomain.com/$1 [R=301,L]Custom 404 Page
I would also suggest a custom 404 page with links to your most popular pages, search and a back button.
Hope this helps.
C
-
I use .net when i build sites, iuse the Application_Error method to see if the error was a 404 tthen 301 to my home page. so any broken link 301 to my home page
-
404 error is rendered when the resource requested is not found. You can do 2 things:
- Implement 301 redirect to the new resource if it is related. The kind of redirect will depend upon the type of server your website is hosted on.
- If 301 redirect is not possible on all the pages (it's understandable), a custom 404 page is a worthy option. It will avoid unnecessary loss of visitors from your site as they tend to get pissed with the default 404 page. It will not only help you retain the visitors but also redirect them to the important pages of your website. E.g.Custom 404 Page
Hope it helps.
Regards
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
We recently updated a large guide that takes the place of the original. The original has some nice organic traffic to it and I don't want to risk losing it. Should I 301 redirect to the new version, or update all the info directly on the original page?
We don't have a lot of content that garners much non-branded organic, so this is something I don't want to risk losing. We do not have a whole lot of external links into the page either.
On-Page Optimization | | AFP_Digital1 -
How to fix duplicate content for homepage and index.html
Hello, I know this probably gets asked quite a lot but I haven't found a recent post about this in 2018 on Moz Q&A, so I thought I would check in and see what the best route/solution for this issue might be. I'm always really worried about making any (potentially bad/wrong) changes to the site, as it's my livelihood, so I'm hoping someone can point me in the right direction. Moz, SEMRush and several other SEO tools are all reporting that I have duplicate content for my homepage and index.html (same identical page). According to Moz, my homepage (without index.html) has PA 29 and index.html has PA 15. They are both showing Status 200. I read that you can either do a 301 redirect or add rel=canonical I currently have a 301 setup for my http to https page and don't have any rel=canonical added to the site/page. What is the best and safest way to get rid of duplicate content and merge the my non index and index.html homepages together these days? I read that both 301 and canonical pass on link juice but I don't know what the best route for me is given what I said above. Thank you for reading, any input is greatly appreciated!
On-Page Optimization | | dreservices0 -
404's Wordpress products
Hi Guy's, On a Wordpress website we have a SEO Ultimate plugin running. Every day i get lot's of 404 errors of products that doesn't exist anymore (but are indexed, site: .... ). In the beginning we had lot's of testproduct that are not coming back in the shop. So i was wondering if there is a way to automaticly redirect product when there are out of stock, or not comming back anymore... So my 404's can be fixed. Thanks!
On-Page Optimization | | Happy-SEO1 -
Inventory Pages that are Sold, 404 vs 301?
I am working with a company that sells high-priced automobiles. Each Unit has its own URL We currently leave most sold inventory live on the site as it draws in many leads (the units are visually shown as sold, so it shouldn't be a UX issue in most cases). We are wanting to start pruning some old units (this is in WordPress - custom post type) and I'm not quite sure what the best solution for this site is with removed units. Some ideas: Remove the units pages that are no longer needed, resulting in any links 404'ing to a useful 404 page. Remove the units pages, and 301 them to the Homepage (I don't really want to do this, as it seems like really poor UX) Remove the units page, and 301 the user to a specific "This item has sold" page that is shared by all sold units, but may not be the sites full 404. another option I haven't thought of? I dont' want to do anything that would confuse or get search engines upset, and I'm not sure how bad 404's are, I see some info on how bad they are, some that say they aren't bad. I'm guessing it is as usual, some gray area in the middle.
On-Page Optimization | | Andy_Staple0 -
301 twice redirect (no negative)
Can i made twice 301 redirect, because i got "droped" domain and i dont want negative effect to new website. Can i redirect users some other way with no negative effect for fresh website?
On-Page Optimization | | cerar0 -
301 Redirect and SEO Rankings
I recently restructured my webpage URL's (about 300 ~ 75% of my total website) to make the URL paths more SEO friendly. Within a few hours of restructuring the pages, I did a 301 redirect to my old URL's and pointed them to the new pages. I have seen ~ 50% drop in organic traffic. I started the restructuring exercise 14 days ago and finished it a few hours back. I have 3 questions: How long will it take for me to recover my old traffic. Will I recover most of it or some of it? Due to a glitch in the specified path, some old URL's were wrongly redirected (this happened with 9 pages to be exact). I will explain exactly what happened: www.redirct.com/superseonow1 ---- redirected to ---- www.redirectnow.com/seonow1 **/superseonow was 301 redirected to /seonow. After 3 days I realize that /superseonow1 was actually /supernow1. The same thing happened to 9 pages - /superseonow2, /superseonow3 ..... ** I have removed all the wrong redirects. When I tried to enter the correct (old) paths now and 301 redirect them to the new paths, the page was not found using the old paths. Should I redirect the old paths to the New ones even now? 3. Finally, in how much time after you change the page structure should you use the 301 redirect. Since I had two different teams working on this job, there could have been up to a 24 hour gap between the redirection.
On-Page Optimization | | rajatsharma0 -
Need to hire an SEO consultant to fix my website
Just started using SEOmoz and discovered lots of issues with my site. Need some help. Obviously the person could access my SEOmoz account and make sense of all that is needed. Then either go to my website and fix or tell me what to do. Thanks, Scott
On-Page Optimization | | ecoscott0 -
301 redirect results in plummeting DA. Why?
I redirected from my .co.uk site to my .com site (www.salesandinternetmarketing) and my Domain Authority has gone from 44 to 33!? Also SEO Moz states that it's crawled all my pages, yet isn't showing any on page reports, inculding keyword usage, meta descriptions, etc. I'm very confused and not receiving clear answers from the support team (they've said one of the reasons is that my keywords are not ranked in the top 50, well some are, nevertheless I should still be getting some report info shouldn't I)? Can someone please help, I'm rather fed up as this has been going on a for a couple of weeks now
On-Page Optimization | | lindsayjhopkins0