I am stuck in a difficult situation here
I have hundreds of addon and subdomains under my "public_html" having WordPress instances inside them. While cleaning up the malware, I have removed the .htaccess files from these several WordPress instances.
now, I am looking for some help here to add back the default .htaccess file and its code for such WordPress instances in one command
is that possible?
Put the default .htaccess file into ~/public_html/default.htaccess
and then use this script to copy it into any WordPress subdirectory that doesn't have a .htaccess file already:
cd ~/public_html
for dir in `ls -F | grep /`
do
if [ ! -e "$dir/.htaccess" ] && [ -e "$dir/wp-config.php" ]
then
cp -v default.htaccess "$dir/.htaccess"
fi
done
It could even be run as a one-liner:
cd ~/public_html; for dir in `ls -F | grep /`; do if [ ! -e "$dir/.htaccess" ] && [ -e "$dir/wp-config.php" ]; then cp -v default.htaccess "$dir/.htaccess"; fi; done