Author Topic: Optional Stub Page on Delete  (Read 4147 times)

Offline bupaje

  • Posts: 589
Optional Stub Page on Delete
« on: November 06, 2008, 03:36:31 AM »
Once Google crawls your site I notice it is hard as heck to get rid of references to pages you have deleted without a 301 permanent redirect page. I don't have htaccess on my Yahoo webhosting and since I test a lot of content I have referenced to pages that are long gone generating errors of Google. I have manually created 301 redirects for some but if there are lots of pages I though of a feature idea.

What if there was an option in WB when you delete or move a page to leave a stub page - a 301 redirect with the old name- and an option to point it to a new section. This way you don't lose the page rank of this moved page and don't end up hundreds of errors listed by Google.

Offline thorn

  • Posts: 980
  • Gender: Male
    • Projects
Re: Optional Stub Page on Delete
« Reply #1 on: November 06, 2008, 10:36:48 AM »
Hello,

what about setting a menulink (visibility: hidden) for this purpose?

thorn.

Offline bupaje

  • Posts: 589
Re: Optional Stub Page on Delete
« Reply #2 on: November 06, 2008, 03:36:27 PM »
I'm not sure how Google would view the menulink redirect. http://sebastians-pamphlets.com/google-and-yahoo-treat-undelayed-meta-refresh-as-301-redirect/ seems to indicate that Yahoo might handle it ok with Google possible seeing it as a 302 instead. Too many spammers use redirects so 301 is probably the safest. I guess I could try to rename the menulink mod, change the redirect code to the 301 code and this might work ... hmmmm... thanks for the suggestion.

Offline thorn

  • Posts: 980
  • Gender: Male
    • Projects
Re: Optional Stub Page on Delete
« Reply #3 on: November 06, 2008, 11:37:58 PM »
Hello,

if you want to force the menulink to generate a 301-redirect
you have to change wb/index.php:
from
Code: [Select]
// redirect
header('Location: '.WB_URL.PAGES_DIRECTORY.$target_page_link.PAGE_EXTENSION.($anchor?'#'.$anchor:''));
exit;
to
Code: [Select]
// redirect with 301
header("HTTP/1.1 301 Moved Permanently");
header('Location: '.WB_URL.PAGES_DIRECTORY.$target_page_link.PAGE_EXTENSION.($anchor?'#'.$anchor:''));
exit;
which will work as expected:
Code: [Select]
http://localhost/wbtest/pages/link.php

GET /wbtest/pages/link.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,en-us;q=0.8,en;q=0.5,ja;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/wbtest/
Cookie: ...

HTTP/1.x 301 Moved Permanently
Date: Thu, 06 Nov 2008 22:34:21 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-5 with Suhosin-Patch
X-Powered-By: PHP/5.2.6-5
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://localhost/wbtest/pages/start22.php
Content-Length: 0
Keep-Alive: timeout=15, max=98
Connection: Keep-Alive
Content-Type: text/htm

thorn.

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: Optional Stub Page on Delete
« Reply #4 on: November 06, 2008, 11:44:48 PM »
Thorn, wouldn't the 301 come with every redirect, or every menulink? And is that wishable?


John
http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....

Offline thorn

  • Posts: 980
  • Gender: Male
    • Projects
Re: Optional Stub Page on Delete
« Reply #5 on: November 06, 2008, 11:56:58 PM »
Hello,

normally, the redirect will generate a 302:
Code: [Select]
// redirect
header('Location: '.WB_URL.PAGES_DIRECTORY.$target_page_link.PAGE_EXTENSION.($anchor?'#'.$anchor:''));
exit;

Code: [Select]
http://localhost/wbtest/pages/link.php

GET /wbtest/pages/link.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de-de,en-us;q=0.8,en;q=0.5,ja;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: UTF-8,*
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/wbtest/
Cookie: ...

HTTP/1.x 302 Found
Date: Thu, 06 Nov 2008 22:54:33 GMT
Server: Apache/2.2.9 (Debian) PHP/5.2.6-5 with Suhosin-Patch
X-Powered-By: PHP/5.2.6-5
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location: http://localhost/wbtest/pages/start22.php
Content-Length: 0
Keep-Alive: timeout=15, max=98
Connection: Keep-Alive
Content-Type: text/html

...

To make this a 301, you have to add header("HTTP/1.1 301 Moved Permanently"); to every redirect.

thorn.
« Last Edit: November 06, 2008, 11:59:07 PM by thorn »

Offline pcwacht

  • Posts: 2923
  • Gender: Male
    • Dutch ICT info
Re: Optional Stub Page on Delete
« Reply #6 on: November 07, 2008, 12:07:52 AM »
Ah, ok, thanks
http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....

Offline bupaje

  • Posts: 589
Re: Optional Stub Page on Delete
« Reply #7 on: November 07, 2008, 12:14:39 AM »
Ah, thanks thorn. What might be the effect of making every menulink a 301?  I just use menulink to direct to a page on my site internally or to hide a more complex url so I guess it should be no problem. Thanks a million. Going to try it right now.

[OK, works like a charm. I will monitor the Google web tools and post and post a follow up here for reference, if indeed his helps to get rid of those errors. ~thanks again]
« Last Edit: November 07, 2008, 12:23:14 AM by bupaje »