Fix permissions and add .htaccess