Localhost configuration and problem with file permissions
The web server must have a properly configured file structure to operate. The files should be placed under /var/www or /usr/local, not under /home. The /etc directory is for system and configuration files, not web data files.

There should be no reason for you to format the root partition when maintaining a system, but if you insist on doing so, put /var /usr and /home on a separate drive, and mount them under the root during boot. That way you will not lose any data.

If you are so desperate to ease the editing, work as root and learn to be careful. But make sure the files are under the correct group and owner for the web server to operate.