WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#4037 closed defect (bug) (fixed)

do_robots() should not serve robots.txt as text/html

Reported by: JeremyVisser Owned by: ryan
Milestone: 2.2 Priority: low
Severity: trivial Version: 2.1.3
Component: General Keywords: has-patch commit
Focuses: Cc:

Description

Environment

WordPress SVN /branches/2.1 rev 5096

Also affects /trunk (rev 5116) and WordPress MU /tags/1.1.1.

Details

In wp-includes/functions.php, the do_robots() function serves up the contents of a robots.txt file. If you try to view the file in a web browser, the line breaks will not show up properly. This is because the mime-type served is the default text/html which instructs the browser to parse the robots.txt file as HTML. This should not be the case.

text/plain is a good mime-type to use, and behaves correctly.

The attached patch will cause the function to serve robots.txt as text/plain.

Attachments (1)

functions.php.diff (424 bytes) - added by JeremyVisser 7 years ago.
Changes the do_robots() function to use the text/plain mime-type.

Download all attachments as: .zip

Change History (4)

JeremyVisser7 years ago

Changes the do_robots() function to use the text/plain mime-type.

comment:1 westi7 years ago

  • Keywords commit added
  • Owner changed from anonymous to ryan

+1

comment:2 ryan7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [5117]) Serve robots.txt as text/plain. Props JeremyVisser. fixes #4037

comment:3 hakre4 years ago

Related: #14069

Note: See TracTickets for help on using tickets.