How to hide a file name in the address bar

Written by nicole martinez Google
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to hide a file name in the address bar
Use the mod_rewrite function to show a different URL in the user's address bar. (adress bar image by Wiktor Osiecki from

If you own or develop a website, you may wish to hide the exact file name of a page, image or other document when a user visits your website. If your hosting server uses Apache software, employ the mod_rewrite function in a Hyper Text Access file to instruct the server to display a different URL in the browser address bar when the visitor loads a specific file. This may be especially useful if you want to show the directory location but not the file name.

Skill level:
Moderately Easy


    Create HTAccess

  1. 1

    Open a text editor such as Notepad on Windows.

  2. 2

    Type, or copy and paste, the following into a blank document:

    RewriteEngine on

    RewriteRule ^old.html$ new.html

  3. 3

    Replace "old.html" with the file name you are trying to hide. For example, if you want to hide "page.html," type "page.html." The backslash instructs the server to treat the period between the file name and type as a regular character.

  4. 4

    Replace "new.html" with a new file name such as "new.html" or directory such as "/directory." You do not need to include the backslash in this expression.

  5. 5

    Open the file menu and choose the option to save. In the dialogue box, type "htaccess" as the file name and select "txt" as the file type.

    Upload HTAccess

  1. 1

    Connect to your Web server. If using FTP, launch your FTP program on your computer and enter your login credential and server information before pressing "Connect."

  2. 2

    Navigate to the directory that contains the file whose name you wish to hide in the "Remote Server" pane of your FTP client.

  3. 3

    Open the folder on your computer that contains "htaccess.txt" in the "Local" pane of your program.

  4. 4

    Double-click the file or right-click and choose "Upload" to upload it.

  5. 5

    Right-click on the file in the remote pane and choose the option to rename it. Change the name to ".htaccess." The file may become hidden, depending on your server and FTP client settings. When users access the old URL, they will now see the new URL in their browser address bar.

Tips and warnings

  • This method only works on Apache and compatible servers.
  • Your Web host must turn on the mod_rewrite function or this will not work.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.