We have a website called example.com

I want these paths and their subdirectories:



to be permanently displayed to visitors as:


In order for the /watch, /bag, and other subdirectories not to be displayed in the URL address bar. In other words, I want to hide the full URL of these subdirectories in the browser.

  • Just clarify, do you want visitors to be able to click on links either on your site or in search engines and have all directories below example.com/vip/alice to display the content for that page, but with example.com/vip/alice as the URL in the browser?
    – dan
    Commented Mar 5, 2017 at 8:40
  • Yes. Exactly that Commented Mar 5, 2017 at 8:42
  • Unless you plan on using just links to find these pages, which is why I asked about search engines, this isn't a very good idea for SEO. Search engines will just see the same URL as what's in the browser. Explaining why you want to do this might be helpful to getting better answers.
    – dan
    Commented Mar 5, 2017 at 8:52
  • I clarified the question for you, though it would be best if you add why you're trying to accomplish this since masking can be tricky and has caveats (such as duplicate content and indexing issues).
    – dan
    Commented Mar 5, 2017 at 9:02
  • 1
    You can't have one URL (eg. /vip/alice) refer to two different "subdirectories" (eg. /vip/members/alice/watch and /vip/members/alice/watch)? "Hiding" subdirectories (or URL-path segments) requires changing the URL structure througout your application. URL-rewriting is just part of this process. Have you already changed the URLs in your application?
    – MrWhite
    Commented Mar 5, 2017 at 10:53

1 Answer 1


Found the solution with external help. This is what I was looking for with mod_proxy enabled in httpd configuration:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteRule ^$ /vip/alice [NC,P]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.