Kyle Cureau
Kyle Cureau

Reputation: 19366

Is there a way to mimic symlink behavior with an apache configuration?

Is there a way to mimic symlink behavior with an apache configuration?

For example, from /var/www/someFolder/ I need to reference files in /var/www/anotherFolder/ but do it without using relative paths (because I'm using subdomains) or absolute paths.

Note: Symlinks work but they don't deploy well from git and from my demo site. I would think an apache configuration is much more deployable then dozens of symlinks

Is there a way? With htaccess? With ServerAlias? etc...

Upvotes: 1

Views: 249

Answers (1)

anubhava
anubhava

Reputation: 785256

If I understood your question correctly then following code in your .htaccess should work fine:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteRule ^someFolder/(.*)$ anotherFolder/$1 [L,NC]

This way a URI of http://domain.com/somefolder will be internally referencing files from /anotherFolder/ folder thus giving you an effect of symlink without creating an actual symlink.

Upvotes: 1

Related Questions