Solved

Symlink in root web

Posted on 2006-07-13
4
255 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
okay thanks.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now