Htaccess access url from a specific url - both at same domain

software development

#1

Hi,

the scenario is,

End URL to load at the html page is

URL A: mydomain.com/report_files/abc.swf

But this should be only loaded if the user comes via

URL B: mydomain.com/users/reports/

When user will click urlB it will check the id of report and load the urlA. So, effectively I dont want to give access to url A to any other person.

I have tried something like this but doesnt work

SetEnvIf Referer "^http://mydomain.com/users/reports/" local_referral #SetEnvIf Referer "^http://mydomain.com/report_files/" auth_referral Order Deny,Allow Deny from all Allow from env=local_referral #Deny from env=auth_referral

I have put this htaccess in report_files directort so that the user with local_referral is allowed only. I have commented the lines for auth_referral because i need to load the swf file from it as well. I am new to this so dont know for sure what can fix it.

Another solution i found and tried is

RewriteEngine On RewriteCond %{HTTP_REFERER} !(www.)?mydomain.com/users/reports/ RewriteRule .* - [F]

It is working. But the swf files folder is not allowed access and gives 403 forbidden access error for them. The swf folder structure is

X: http://mydomain.com/users/reports/.swf
Y: http://mydomain.com/users/reports/files/
.*

Actually swf file in X uses some helping files e.g. fonts, images etc from /files/ inside the /reports/ directory. And the referrer for it is changed.

I think I need nesting solution.