How can I get htaccess to do a redirect with masking?

I have a WordPress site hosted on Siteground with a name like [realsitename.com](https://realsitename.com/). It has a page called [realsitename.com/specialpage](https://realsitename.com/specialpage).

What I want is when someone enters [othersitename.com](https://othersitename.com/) in their browser, it gets redirected to [realsitename.com/specialpage](https://realsitename.com/specialpage) with masking, so it looks to the user like they are on [othersitename.com](https://othersitename.com/). Currently, [othersitename.com](https://othersitename.com/) is parked on the web server and its DNS is correctly pointing to the server.

Below is the code I have at the bottom of htaccess that isn’t quite working:

RewriteEngine on
RewriteCond %{HTTP_HOST} othersitename.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.othersitename.com [NC] RewriteRule ^(.*)$ ^/specialpage [L,R=301,NC]

But the result of entering [othersitename.com](https://othersitename.com/) in the browser is that you get redirected to [http://othersitename.com/%5erealsitename.com/specialpage](http://othersitename.com/%5erealsitename.com/specialpage), which is a 404 error. What am I doing wrong?

2 Comments
  1. Just set ‘specialpage’ to be your homepage. Or do you only want it to happen for that specific domain name?

    Try setting the RewriteRule to be the absolute address, rather than the relative.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer