Redirect apache request to another domain

if you have example

portal.tenerife.com
portal.mazaredo.com
portal.antolines.com

and you want to redirect it to www.mazaredo.com

in httpd.conf put this line

RewriteEngine on
RewriteCond %{HTTP_HOST} !^portal\.!^\.com$ [NC]
RewriteRule ^(.*)$ http://www.mazaredo.com/$1 [R=301,L]

As you can see the the url has 3 parts    portal, domain, com

 !^portal\.!^\.com$

first part is !^portal\     you can also remove portal so any .com request going to your site will be redirected.
second part is !^\ where it is like * anything.
last part is .com$

Comments

Popular posts from this blog

Black screen after logging in on Windows 2012 R2 using domain credentials on remote desktop connection

Water Wonder Resort

Client denied by server configuration error