this is my piece of my php code also do anyone know why its add $htaccess text for xample if i have folder admin it create file index.html with text from $htaccess = "example"; but if i have more that 1 folder the next index will include the text exampleexample and third index exampleexampleexample so its copiying example to every index and not replacing it $error_write = false; $error_create = false; $success = false; if(file_exists("index.html")){ if(is_writable("index.html")){ $fh = fopen("index.html", 'w') or $error_create = true; if($fh){ fwrite($fh, $htaccess); fclose($fh); $success = true; } }else{ $error_write = true; } }else{ $fh = fopen($file,"w+") or $error_create = true; if($fh){ fwrite($fh, $htaccess); fclose($fh); $success = true; } PHP: