HTA – Redirect everyone for site maintenance

Version: 13.2
Revision: 34 Build 13

HTA – Redirect everyone for site maintenance.

Introduction:
When I checked my email, I had a request from a uni-student.
He’s asked me for help. It’s about blocking users from his old domain and redirecting them to his new domain.

Notes: this is also useful if you want to tell “Google Engine” that you are changing domain name.

Anyway, if anybody wants to use this script, then you must have “Static IP Address + HTA Engine.” However, if you haven’t got HTA engine, then you’ll need to consult this problem with your provider.

Warning: if you want to check your old domain, you must input the correct IP address (your IP Address), or else, you be redirected to your new domain. Also, if you want to keep this script, then you’ll need to comment out “Remote Address”. Just add ‘#’ before each command. But, there is another thing: this will only work if you still have your previous domain name.

Finally, if you have SSL encryption, please use this command: “https” – encrypted connection.

Caution *1: if there is a problem with the script, just keep it simple and remove “R=301″ and replace it with “R”.
Caution *2: if your website has SSL, then please comment “HTTP_HOST” and remove comments for this command: “SERVER_PORT”.

HTA – Redirect everyone to a new domain (accept you).
———— Copy Text —————

RewriteEngine On
Options +FollowSymLinks
# This is where you add your IP address.
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
#---------------------
# This is use if your hosting provider requires ports.
# RewriteCond %{SERVER_PORT} 80 [NC,OR]
# RewriteCond %{SERVER_PORT} 443 [NC]
# RewriteCond %{REQUEST_URI} example
#---------------------
# Match a specific domain OR sub domain (if it exist).
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.cc$ [NC]
# %1 is the sub domain (or empty).
RewriteRule ^(.*)$ http://%1example.net/$1 [R=301,L]
# RewriteRule ^(.*)$ https://%1example.net/$1 [R=301,L]

———— End —————

Notes: if you don’t have SSL and the above looks complicated, please use this instead.
———— Copy Text —————

RewriteEngine On
Options +FollowSymLinks
# This is where you add your IP address.
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
# Match a specific domain OR sub domain (if it exist).
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^(.+\.)?example\.co\.cc$ [NC]
# %1 is the sub domain (or empty).
# %2 is SSL encryption (or disabled)
RewriteRule ^(.*)$ http://%1example.net/$1 [R=301,L]

———— End —————

Copyrighted By Lair360

Comments are closed.