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
-
Is this method of redirecting of 404 okay?
Hi all, This is my first post at this forum 🙂 I'am running a Opencart shop with a SEO extension installed. This extension has a redirect module which works like this. When visiting the site on 404 url (and if there is setup a redirect for that url). It serves the correct content but on the 404 url with the correct url set in rel canonical. For example: Try visit this url:
On-Page Optimization | | mrmagnecom
https://makitech.no/ventilasjon/ventilasjons-pakketilbud
Here i have setup a redirect to the correct content, which is actually this url https://makitech.no/pakketilbud I am used to use a 301 header redirect so the user get redirected to the correct url. So my question is this. Is it a okay practice to serve the content on the 404 url (it responds 200) when the correct url is set in canonical? Any thoughts?0 -
How to Fix Google Webmasters Soft 404 Errors for Wordpress Site?
I am getting Soft 404 errors in my Google Webmasters Tools don't know how to fix it the site in on WordPress CMS the site is "http://appdictions.com/" i am getting errors in the http://appdictions.com/members section...suggestion to fix the issue will be appreciated..
On-Page Optimization | | preferati0 -
301 vs 302 redirect
Hello Mozers, I have a website which offers subscriptions on a monthly basis, when one profile expires the link of the profile gets a 301 redirect to the main category, just that if the member chooses to come back after a while he can reactivate the profile and the link will work again and the 301 will disappear, Should I be doing 302 redirect, as from this point of view it's only a temporarily redirect ? Thanks in advance
On-Page Optimization | | asmedia0 -
Is it impossible to get out of Panda? Matt Cutts says if you fix the problem you "pop back" but if so why are their so few examples?
In this video matt cutts says: http://www.youtube.com/watch?v=8IzUuhTyvJk about 15 "once we re-run our data (every few weeks) if we determine your site is of higher quality you would pop back out of being affected" Panda has effected thousands of sites and a lot of smart people have been working on the problem for about 2 years since the first panda was launched, but I can only find 1 site that has "popped back" to their original rankings. e.g. http://searchengineland.com/google-panda-two-years-later-losers-still-losing-one-real-recovery-149491 Apart from Motortrend.com I can't find any sites (of reasonable size) / case studies of sites that have solved the panda problem, and were definitely hit by panda. Which doesn't feel right, some people have deleted a ton of pages, redesigned their site, improved their content, etc with no success. Therefore is it a pointless exercise? Therefore, is it better to simply give up and start a new site?
On-Page Optimization | | julianhearn1 -
Redoing a site - 404 redirect or 301 redirect
I'm redoing a website, should i 404 the old pages, or 301 redirect to the main page? what is better? (around 100 pages)
On-Page Optimization | | mkmedia0 -
My report also notes that I have 176 Rel Canonical. What does this mean and how do I fix it. Thanks
My report also notes that I have 176 Rel Canonical. What does this mean and how do I fix it. Thanks http://pro.seomoz.org/campaigns/95663/issues/18
On-Page Optimization | | cyaindc0 -
301 redirect and then keywords in URL
Hi, Matt Cutts says that 301 redirects, including the ones on internal pages, causes the loss of a little bit of link juice. But also, I know that keywords in the URL are very important. On our site, we've got unoptimized URLs (few keywords) in the internal pages. Is it worth doing a 301 redirect in order to optimize the URLs for each main page. 301 redirects are the only way we can do it on our premade cart For example (just an example) say our main (1 of the 4) keywords for the page is "brown shoes". I'm wondering if I should redirect something like shoes.com/shoecolors.html to shoes.com/brown-shoes.html In other words, with the loss of juice would we come out ahead? In what instances would we come out ahead?
On-Page Optimization | | BobGW0 -
301 redirect (www.domain.com/index to www.domain.com)
Hello, Please let me know what are the exact right steps in order to get rid of the duplicate content issues related with: www.domain.com/index.html same as www.domain.com without creating an infinite loop. Do you have a step by step guide posted within seomoz including 301 redirect for non www to www for all urls and index.whatever to main domain name without going into a infinite loop ? btw how to you spot the loop ? is it obvious like never ending refresh of the home page ? thanks a lot !
On-Page Optimization | | eyepaq2