Hostwinds Tutorials

Search results for:

Table of Contents

What is URL Masking?
How Do I Create a URL Mask Redirect?

URL Masking Using .htaccess

Tags: htaccess 

What is URL Masking?
How Do I Create a URL Mask Redirect?

There are two main types of redirects, temporary and permanent. We will focus on another type of redirect called URL Masking in this guide and review how to accomplish URL Masking by Editing a .htaccess file.

Let's get started.

What is URL Masking?

URL masking would be when you redirect to a new domain, but instead of the URL changing, it would stay the same. For example, if you have a domain mask redirect between and When redirects to, it will not switch the URL. It would continue to be

How Do I Create a URL Mask Redirect?

There are a couple of ways to make a redirect for your domain, like using code with HTML. We are going to be using your .htaccess file for this redirect mask.  If you have not already created a .htaccess file, go check out our guide: Creating And Editing An .htaccess File. That guide will show you how to create and some ways to edit your .htaccess.

Now that you have your .htaccess file created, we can go ahead and use the following code to redirect your website with a URL mask.

#Making a URL Mask.
RewriteEngine On
RewriteRUle ^example/?$ /example2/mask

When someone opens up, it will show the contents of another folder in example2 above. Replace examples above and example2 to display the desired content that you wish to have displayed.

#Redirect a domain to a specific URL
RewriteEngine On
RewriteCond %{HTTP_HOST} ^
RewriteRule ^(.*) [P]

In the above example, replace with your domain name and the domain you wish to send to in

When you put this code into your .htaccess, you will redirect and see the content for, but you will still see the URL for

Written by Hostwinds Team  /  August 1, 2019