[wp-trac] [WordPress Trac] #7203: Additional linebreak needed when writing to .htaccess

WordPress Trac wp-trac at lists.automattic.com
Sun Jun 29 01:44:10 GMT 2008


#7203: Additional linebreak needed when writing to .htaccess
-------------------------+--------------------------------------------------
 Reporter:  johnbillion  |       Owner:  anonymous
     Type:  defect       |      Status:  new      
 Priority:  high         |   Milestone:  2.5.2    
Component:  General      |     Version:  2.5.1    
 Severity:  major        |    Keywords:  htaccess 
-------------------------+--------------------------------------------------
 When WordPress writes to the .htaccess file when a user first saves their
 permalink settings, if an .htaccess file already exists and does not end
 with a blank line, WordPress will corrupt the .htaccess file by appending
 `# BEGIN WORDPRESS` onto the end of the last line of the file.

 '''Steps to reproduce:'''

  1. Either create a new blog or switch off all permalink settings in your
 current blog.
  2. Create (or edit your existing) .htaccess file so that it contains some
 data. Do not include a blank line (eg. a line break) at the end of the
 file.
  3. Now go to your permalink settings page and enable pretty permalinks.
  4. Open up your .htaccess file again and observe that WordPress has
 appended `# BEGIN WORDPRESS` to the end of the last line in the file, thus
 corrupting whatever data the line contains.

 '''Solution:''' Whack a "\n" in before `# BEGIN WORDPRESS` to ensure the
 last line in the file is left alone.

 Patch coming up!

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7203>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list