Redirect urls exactly, just change domain name with Apache

RewriteEngine On
RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$$1 [R=301,L]

Redirect Type

301 Permanent Redirect
307 Temporary Redirect

Password Protect Folder with Apache .htaccess file

Create new file named “.htaccess” in the folder with this Content

AuthName "Password Protected!"
AuthType Basic
AuthUserFile /home/cpanel_user_name/public_html/folder_name/.htpasswd
require valid-user

*Change cpanel_user_name & folder_name

Create new file named “.htpasswd” in the same folder with this Content (Username:Password)