WebsiteBaker Community Forum

General Community => Global WebsiteBaker 2.8.x discussion => Topic started by: bupaje on November 06, 2008, 03:36:31 AM

Title: Optional Stub Page on Delete
Post by: bupaje 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.
Title: Re: Optional Stub Page on Delete
Post by: thorn on November 06, 2008, 10:36:48 AM
Hello,

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

thorn.
Title: Re: Optional Stub Page on Delete
Post by: bupaje 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.
Title: Re: Optional Stub Page on Delete
Post by: thorn 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.
Title: Re: Optional Stub Page on Delete
Post by: pcwacht 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
Title: Re: Optional Stub Page on Delete
Post by: thorn 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.
Title: Re: Optional Stub Page on Delete
Post by: pcwacht on November 07, 2008, 12:07:52 AM
Ah, ok, thanks
Title: Re: Optional Stub Page on Delete
Post by: bupaje 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]