Link to home
Start Free TrialLog in
Avatar of ray-solomon
ray-solomonFlag for United States of America

asked on

Symlink in root web

Is it possible to have a symbolic link in the root web that points to a .htaccess file outside of the root web and still be able to use mod_rewrite?

/var/www/.htaccess
/var/www/html/{symlink}

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com$      [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|js)$ - [F,NC]
Avatar of caterham_www
caterham_www
Flag of Germany image

Why a symlink to that .htaccess file? /var/www/.htaccess is on the way to /var/www/html/, so it will be executed, if there are no RewriteRules present in /var/www/html/.htaccess or below. Otherwise you must use the RewriteOptions directive.
Avatar of ray-solomon

ASKER

I intend to have no .htaccess file in the root web, just a symlink to it. The rewrite rules will be in the .htaccess file below the root web.

My reasoning is to create a shell script that will add/delete rewrite rules to it for me automatically upon certain events. I do not want the .htaccess writeable in the root web to make it safer.

So you say it is okay to go about this?
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
okay thanks.