How to Cloak URL on Redirect

By Benjamin Aries

A cloaked URL redirects traffic on a web server.
i Comstock/Comstock/Getty Images

URL masking, also known as URL cloaking, is a method that is used to redirect website visitors to a new location on the Internet. Normally, a web user can see the actual URL address for the current page in a web browser. With a cloaked URL, however, data from a second location is displayed even though the URL address does not appear to change in the browser. This technique is commonly used when web pages change location, but webmasters do not wish to confuse visitors by changing existing links.

Step 1

Create an HTACCESS file to control the URL redirect. Open Notepad or another simple text editor. Click "File" and then "Save As." Select "All Files" from the "Save As Type" drop down menu. In the "File Name" field, enter ".htaccess" and click "Save." Note that the period before "htaccess" is required.

Step 2

Enter code into the newly-created HTACCESS text document. Type "RewriteEngine On" for the first line. On the next line, enter "RewriteCond %{REQUEST_URI} ^/exampleone($|/)" and replace "exampleone" with the host directory name that will be cloaked. Type "RewriteRule ^.*$ /exampletwo/index.html [L]" on the third text line. Use the actual destination folder or URL in place of "exampletwo."

Step 3

Click "File" and then "Save" to store the modifications to the HTACCESS document. Launch the FTP transfer program for the website. Locate the local folder that holds the saved HTACCESS file, and upload this file to the root directory of the website.

Step 4

Open a web browser and test that the URL redirect masking works correctly. For the example listed here, type "http://www.example.com/exampleone" and press enter. Verify that this address is shown in the browser bar, even though the content at "http://www.example.com/exampletwo/index.html" is actually displayed.

×