Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Symlink in root web

Posted on 2006-07-13
4
259 Views
Last Modified: 2010-03-04
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]
0
Comment
Question by:ray-solomon
  • 2
  • 2
4 Comments
 
LVL 27

Expert Comment

by:caterham_www
ID: 17115981
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.
0
 
LVL 10

Author Comment

by:ray-solomon
ID: 17116060
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?
0
 
LVL 27

Accepted Solution

by:
caterham_www earned 500 total points
ID: 17118445
Yes, but if you're smylinking from
/var/www/html/{symlink} to
/var/www/.htaccess and not to
/something/complete/other/.htaccess, you won't need a symlink, because for a request of /var/www/html/abc, /var/www/.htaccess will be processed automatically.
0
 
LVL 10

Author Comment

by:ray-solomon
ID: 17119657
okay thanks.
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question