notepad.exe vs. .htaccess

Danger…

I was editing an a .htaccess file via FTP (right click, edit this) and wanted to add a rewrite rule for a subdirectory to make it act like a subdomain. Saved the file, FTP threw it up, reload the page, then:

500 SERVER ERROR

Crap. This is a production website that I was trying to unobtrusively work in a development sub-environment on. There’s nothing quite like bombing out the entire website with an unusable .htaccess file. 

I figured the problem was in my code so I quickly deleted what I added and resaved, ftp uploaded it and… still a 500 error!

Come to find out my Notepad decided to concatenate all of my apparent line breaks into unreadable supercalafragalistic chunks.

So instead of this:

RewriteEngine OnRewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d

It looked more like this:

RewriteEngine On

RewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-d

Solution: used notepad++ and fixed it. No more 500 errors and my rewrites work now too.