Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Do URL Masking with .htaccess

This guide shows how to show visitors one web address while the content really comes from another place.

How-To Guides2 min read8 steps

What is URL masking?

A URL is a web address. With masking, a visitor types yourdomain.com/shop, but the page really comes from another folder or site. The address bar still shows the first one. This is different from a redirect, which changes the address bar to the new place.

The .htaccess file is a small settings file for Apache web servers. It sits in your website folder. Rules inside it use a tool called mod_rewrite, which rewrites addresses. Ask Hostvento support if your plan does not use Apache.

Warning: a mistake in .htaccess can show a "500 error" on your whole site. Back up the file first.

Steps

  1. Log in to your control panel and open the File Manager.
  2. Go to your website folder, often public_html.
  3. Click Settings and tick Show Hidden Files, because .htaccess starts with a dot.
  4. Right-click .htaccess and choose Copy to make a backup. If the file does not exist, create it.
  5. Right-click the original and choose Edit.

Example 1: Mask a folder

Show the content of /pages/about-us at /about:

RewriteEngine On
RewriteRule ^about/?$ /pages/about-us/ [L]

The visitor sees /about. The server loads the other folder quietly.

Example 2: Mask another site

Show a different site's content under your address:

RewriteEngine On
RewriteRule ^(.*)$ https://example.com/$1 [P,L]

The P flag means proxy. It fetches the content for the visitor. This needs the proxy module to be on, which many shared plans do not allow. Ask Hostvento support if it works on your plan.

Example 3: Clean address for a script

RewriteEngine On
RewriteRule ^product/([0-9]+)/?$ product.php?id=$1 [L]

The visitor sees /product/25, while the server runs product.php?id=25.

  1. Click Save Changes.
  2. Test the address in your browser.
  3. If you get an error, restore the backup copy.
Tip: Masking another site can confuse visitors and search engines. Use it only when you have a good reason and own both sites.

Quick recap

  • Masking keeps your address while the content comes from elsewhere.
  • Use RewriteRule in .htaccess.
  • Back up the file before you edit.
  • Test and restore if something breaks.