Link to home
Start Free TrialLog in
Avatar of hankknight
hankknightFlag for Canada

asked on

Rewrite to parent directory if not found

I want to rewrite all files that are not found in ./webAssets/ to the parrent directory.

If this is NOT found:
./webAssets/image/graphic.gif

Then I want to rewrite the URL as:
../webAssets/image/graphic.gif

If this is NOT found:
./webAssets/media/movie.mov

Then I want to rewrite the URL as:
../webAssets/media/movie.mov
Avatar of caterham_www
caterham_www
Flag of Germany image

Where do you plan to put the rewrite rules and how does the URL-path look like?

I.e. to reach
"If this is NOT found:
./webAssets/image/graphic.gif"

you're calling example.com/foo/bar/webAssets/image/graphic.gif

which should be rewritten to
example.com/foo/webAssets/image/graphic.gif

and the rewrite rules are e.g. in a example.com/foo/.htaccess?
Avatar of hankknight

ASKER

I will place the directives in an .htaccess file located here:
http://example.com/foo/bar/.htaccess

And I want
http://example.com/foo/bar/webAssets/images/pic.jpg

Rewritten here:
http://example.com/foo/webAssets/image/pic.jpg
ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial