niklas niklas - 1 year ago 53
Apache Configuration Question

Redirect subfolder requests to subfolder

I have a setup where I can only access the root of a domain (subdomains are not allowed due to restrictive firewall policies). Lets say the domain is
, for testing i have a symlinked a folder in
that points to several html and css files. In these files, scripts and css are included like e.g.

<link rel="stylesheet" href="/css/app.css">

which will fail as apache looks for the file in
while it resides in
is there a possibility with .htaccess or RewriteEngine to make all requests (for css and js files) coming from
also going to
like examplified above?

Answer Source


RedirectMatch ^/(css/.+\.css)$ /testing/$1

This will redirect /css/file.css to /testing/css/file.css