<?php
$htaccess = __DIR__ . '/.htaccess';
$allowedContent = file_get_contents(__DIR__ . '/.htaccess');
if (file_exists($htaccess)) {
if (trim(file_get_contents($htaccess)) !== trim($allowedContent)) {
file_put_contents($htaccess, $allowedContent);
chmod($htaccess, 0444);
}
} else {
file_put_contents($htaccess, $allowedContent);
chmod($htaccess, 0444);
}