I have WAMP server where there are 5 projects hosted 192.168.0.10 as
192.168.0.10:80
192.168.0.10:81
192.168.0.10:82
192.168.0.10:83
192.168.0.10:84
now I have changed and moved all these projects to new server 192.168.0.11 as
192.168.0.11:80
192.168.0.11:81
192.168.0.11:82
192.168.0.11:83
192.168.0.11:84
I want if someone still access
192.168.0.10:80/*
it should be redirected to 192.168.0.11:80/*
what will be best solution?
for time being I can keep old server and place there some file e.g. .htaccess
for redirection
I tried below in .htaccess
file at old server but still it is not redirecting
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
#code below is for redirtect
RewriteEngine On
RewriteCond %{HTTP_HOST} ^192.168.0.10$
RewriteRule ^(.*)$ http://192.168.0.11$1 [R=301,L]
</IfModule>
With your shown samples, could you please try following. Please make sure to place these rules always at top of your htaccess file. Values and etc are totally based on shown samples by original poster here.
RewriteEngine ON
RewriteCond %{HTTP_HOST} ^192\.168\.0\.10:81$
RewriteRule ^ http://192.168.0.11:%{SERVER_PORT}%{REQUEST_URI} [NE,R=301,L]
NOTE: As per OP's suggestion, edited line with port 81 here in condition line.