Redirect to other domain but keep typed domain

It is possible to get it done via mod_rewrite but make sure mod_proxy is enabled in your Apache’s httpd.conf. Once that is done enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.be$ [NC]
RewriteRule ^ http://www.mydomain.nl%{REQUEST_URI} [L,NE,P]

Take note of flag P which is used for handling the proxy request.

Read more about flag: P in mod_rewrite

Leave a Comment