Sending 404 when there is no actual content
authorAlexander Ebert <ebert@woltlab.com>
Fri, 24 Apr 2015 14:28:33 +0000 (16:28 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 24 Apr 2015 14:28:33 +0000 (16:28 +0200)
wcfsetup/install/files/lib/form/SearchForm.class.php
wcfsetup/install/files/lib/page/MembersListPage.class.php
wcfsetup/install/files/lib/page/TaggedPage.class.php

index 4aff50893b28b5258b0f978703ea8362a02c0aba..9119a4753c70c88e8a6815c2534326939319cf52 100644 (file)
@@ -286,6 +286,8 @@ class SearchForm extends AbstractCaptchaForm {
         * Throws a NamedUserException on search failure.
         */
        public function throwNoMatchesException() {
+               @header('HTTP/1.0 404 Not Found');
+               
                if (empty($this->query)) {
                        throw new NamedUserException(WCF::getLanguage()->get('wcf.search.error.user.noMatches'));
                }
index 88f1355feac3b2bba7065ffc5008a009bc242203..6873bc1a104540e045d9f5fdceb11f038d7e92fa 100644 (file)
@@ -160,5 +160,9 @@ class MembersListPage extends SortablePage {
                        'sidebarName' => 'com.woltlab.wcf.user.MembersListPage',
                        'allowSpidersToIndexThisPage' => true
                ));
+               
+               if (count($this->objectList) === 0) {
+                       @header('HTTP/1.0 404 Not Found');
+               }
        }
 }
index fdcfbddb89e172789a800a1a57cebce06fdd7ea3..3325d97057cf6501e11a4ba406d84b53f6fe82cb 100644 (file)
@@ -154,5 +154,9 @@ class TaggedPage extends MultipleLinkPage {
                        'resultListApplication' => $this->objectType->getProcessor()->getApplication(),
                        'allowSpidersToIndexThisPage' => true
                ));
+               
+               if (count($this->objectList) === 0) {
+                       @header('HTTP/1.0 404 Not Found');
+               }
        }
 }