Issue 1048 file editing

Path to file was (re-)defined numerous times as the same. Now set at top of the file and re-used everywhere.

This should fix the notices mentioned in #1048 - `file_exists()` check and `fopen()` could have been looking for different files in the old code.

Also: added filesize check to prevent notices from empty .htaccess reads.