1

I want to create an automatic 301 redirect of all deleted webpages (that doesn't have a specific redirection) to root, in .htaccess .

Instead of using the following pattern for each of my ~ 150 deleted urls, I want all to redirect to the Homepage:

Redirect [status] URL-path URL

Yet, 2 things are important for me:

  1. Specific redirects like in the following code, won't be affected.
  2. The redirect shouldn't be for a specific domain, but rather for the root, whatever it is named; This is good in case tomorrow I decide to change the site's domain.

The reason I want to create these 301 is because ~ 150 links that I deleted about 2 to 3 years ago are still time and again considered "404" by Google, even though I clicked "mark as fixed" about 10 times now.

BTW 95% of these 404's are Hebrew aliases, and now, from various reasons, I use only English aliases (I've written on this here), so basically it's not a big deal for me to permanently block them or just redirect them to my homepage.

3

FINAL ANSWER UPDATE

So I just learned the reason the OP wants to use 301 redirect is get rid of the annoyance of recurring errors even though new site maps have been submitted and marked as fixed.

Use a 410 redirect to completely remove the URL's from index and recurring 404 error notices.

To remove a directory, add something like this to you htaccess file:

Redirect 410 /path_to_directory

Here is what Google has to say about 404 removals:

Make removal permanent

The Remove URLs tool is only a temporary removal. To remove content or a URL from Google search permanently you must take one or more of the following additional actions:

  • Remove or update the actual content from your site (images, pages, directories) and make sure that your web server returns either a 404 (Not Found) or 410 (Gone) HTTP status code. Non-HTML files (like PDFs) should be completely removed from your server. (Learn more about HTTP status codes)
  • Block access to the content, for example by requiring a password.
  • Indicate that the page should not to be indexed using the noindex meta tag. This is less secure than the other methods.

A 301 redirect for deleted pages doesn't make sense. A redirect tells a user and search engines a page or site name has moved and you direct/point them to the new correct page or URL.

That is not the case here. A 404 error will work fine and what most people do not realize is, 404 error pages do not affect your ranking. Google simply asks that 404 error pages should at least have a link a user can still navigate with. A nice little description is better for the user (ie. the page you are looking for no longer exists and maybe have a link to the home page and or category that may be similar.

That is what the real situation is and not this current page has permanently moved to this page. If it doesnt add up to the user it wont to the search engine as well.

If you change your domain name, a 301 redirect is the right method.

With custom 404 pages you can have fun or be creative and get a chance to use CTA's. It is more engaging than redirecting them from where they thought they were going, to someone imposed on them.

404 page

  • I agree. Search engines do not like inappropriate redirects for pages that do not exist. From an SEO perspective, this is a bad practice. It was standard operating procedure many many years ago when IP packets where chiseled on stones, however, a custom 404 replaced that notion rather quickly and remains today. For the OP, it is far better to create a custom 404. How that is done depends upon the web server of course. – closetnoc Sep 25 '16 at 23:30
  • closetnoc, what you say is interesting, I will indeed create custom redirects. Thank ya! – JohnDoea Sep 26 '16 at 12:50
  • What do you guys think of using the syntax Redirect 301 /old-page / ? You sure know how flexible it is --- Involves no protocols/Cnames or extensions (.html); Just a plain alias, and a root slash to point to. For me it's very practical and comfortable. – JohnDoea Sep 26 '16 at 12:52
  • @Benia closetnoc always says interesting things. As for the 301, again if the page is not directing a the old current page URL to the new current page URL, then it is misleading. A 404 is what is taking place, that indeed that page is no longer available. You can have fun with 404 pages and have a chance to use CTA's. It is more engaging than redirecting them from where they thought they were going, to someone imposed on them. Check my update 404 error page. – norcal johnny Sep 26 '16 at 13:12
  • Thank you for this detailing Norcal. I do want to ask what will you say in relation to the special case I now described in the end of my question? It haunts me for 2 years and even more than that actually. – JohnDoea Sep 26 '16 at 13:22
1

I agree with norcal johnny's answer; using a 301 redirect for deleted pages doesn't make sense.

It's also potentially disruptive, if (for example) I write down a URL on a piece of paper and then type it in, and make a mistake. Now, instead of fixing the mistake any trying again, I have to re-type the URL all over again, because the 301 caused the browser's address bar to change. In an extreme case, I might not even realize at first that I made an error.

Hard 404s are normal. Just provide some relevant links; at the very least, provide a clear link back to the front page of your site.

Soft 404s (a "not found" page served with a 200 OK status code) is a serious problem for some use cases. Never, ever serve soft 404s. Like Yoda says, do, or do not; there is no try. Content either exists or it does not exist, and the response status code should reflect its existence. Schrödinger's cats are for physicists.

As for your last point,

in case tomorrow I decide to change the site's domain

you really should read and contemplate Cool URIs don't change from 1998. It's somewhat dated in parts, but the message remains highly relevant to this day. You control the mapping between the URI and the content; make sure that mapping is sensible, and URIs will remain stable even during major content overhauls.

  • Much thanks for the answer Michael! I've just edited my answer and added a note in the end of my question, can you please read it and expand you answer respectively ? Would thank you dearly ! – JohnDoea Sep 26 '16 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.