views:

24

answers:

2

I am trying to achieve something that I am not sure if htaccess can even do.

What I have is a folder structure:

  • myapp
    • some_folder
      • some.js
  • www
    • css
    • js

now the web root is pointing at www folder so i can do http://mydomain.com/js/jquery.js and it would work but what I want to do is http://mydomain.com/myapp/some_folder/some.js and it should load some.js and serve it.

Is it possible to do this in htaccess?

A: 

AFAIK, you can't point to directories outside the current web root from within .htaccess.

There is the Alias directive but in the .htaccess file, it works only below the web root. It would have to be in the central configuration file to accept absolute paths.

As far as I know, this limitation applies to all other directives that could help here, too (RewriteRule etc.)

The only workaround that comes to mind is using symlinks. Whether you can do that, heavily depends on your operating system and access to the server.

Pekka
A: 

you can redirect upwards, just using the .. parent directory identifier. for example:

RewriteRule (.*) ../$1

but only if the destination still lies within your webroot. in your cas it seems not to, so your only chance is to create a symlink/hardlink to that directory or do some file including

alias rewriting in your server cfg file however would work.

Joe Hopfgartner