The URL of a page in my site is:


I want to mask access this page via:


The problem is within this page there are subfolders and, let's say, when I define a .js file in the index.html header:

<script type="text/javascript" src="lib/mylib.js"></script> 

It says file not found because it's looking for it in /fast/quick.

==> Remember the redirection must be masked, not direct.


1 Answer 1


Have you tried using the full URL?

<script type="text/javascript" src="http:/mysite.com/lib/mylib.js"></script> 

or even

<script type="text/javascript" src="/lib/mylib.js"></script>

One of the best ways to find your own answer is to experiment.

  • Tried. Not working. This works but it's a full redirect, no masking: RewriteRule ^ops/en?$ /course/en/accessible_ops$1 [R] I need masking :)
    – Alvaro
    Jan 20, 2017 at 19:56
  • Plus there's a bunch of relative paths in this page. I don't want to have to rewrite them all as absolute paths.
    – Alvaro
    Jan 20, 2017 at 20:17
  • when it doesn't work, what is the error in the console? That will give you a clue on how to solve this.
    – Steve
    Jan 20, 2017 at 20:27
  • Error in console is: anything with relative path is not found. If I type the absolute path it will work but this is what I'm trying to avoid. I want the URL to be masked but the site to act like if inside another subfolder.
    – Alvaro
    Jan 20, 2017 at 20:30
  • I don't know the answer, but a kludge solution would be to hard code the javascript
    – Steve
    Jan 20, 2017 at 20:34

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.