Make WordPress Core

Ticket #13115: 13115.patch

File 13115.patch, 654 bytes (added by solarissmoke, 15 years ago)

set is_robots only if wp is at the root of the domain, otherwise set 404. This looks a little clumsy to me, so a better implementation is welcome

  • query.php

     
    12401240                $this->query_vars = $this->fill_query_vars($this->query_vars);
    12411241                $qv = &$this->query_vars;
    12421242
    1243                 if ( ! empty($qv['robots']) )
     1243                // is_robots is only true if WP is installed at the root of a domain
     1244                $home_path = parse_url(home_url());
     1245                if ( ! empty($qv['robots']) && ( !isset($home_path['path']) || $home_path['path'] == '/' ) )
    12441246                        $this->is_robots = true;
     1247                else
     1248                        $qv['error'] = '404';
    12451249
    12461250                $qv['p'] =  absint($qv['p']);
    12471251                $qv['page_id'] =  absint($qv['page_id']);