I have a site e.g. example.wordpress.com
(a subsite wordpress multisite) but I want users to see the content of that site under a different domain e.g. cooking.com
. I have A record setup for both domains to forward to same IP, and I have read that if I want to keep domain name in the URL that I need to use mod_proxy
. This is my setup:
<VirtualHost *:80>
ServerName cooking.com
ProxyRequests Off
<Proxy *>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Proxy>
ProxyPass / http://example.wordpress.com/
ProxyPassReverse / http://example.wordpress.com/
</VirtualHost>
However, when I type cooking.com
in my browser, it redirects me to example.wordpress.com
and displays its URL instead of cooking.com
. What's wrong with my apache file?
I have also tried using mod_rewrite
instead, but I still get the same result:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^cooking.com$ [NC]
RewriteRule ^(.*)$ http://example.wordpress.com/$1 [L,P,NC]
I have enabled mod_proxy
and mod_proxy_http
, and I'm using Apache 2.4 on Ubuntu 16.04.