Mehrad
Mehrad

Reputation: 23

set htaccess for access to this file Directly

i want all of file in folder /client/ just available to access by subdomain.site.com

to another say i have Some swf(flash) file in folder /client/ For example /client/1.swf that if user enter this address in browser: site.com/client/1.swf he can's access to this file Directly

but i want user just can accessible to site.com/client/1.swf address through subdomain.site.com

anybody can help me for set htaccess file !?

Upvotes: 1

Views: 72

Answers (2)

Panama Jack
Panama Jack

Reputation: 24448

Another way is to Create an .htaccess file in client. Like /client/.htaccess Then put this code.

Apache 2.2

order deny,allow
deny from all
allow from 127.0.0.1

Apache 2.4

Require all denied
Require ip 127.0.0.1

Upvotes: 1

Jon Lin
Jon Lin

Reputation: 143876

Try adding this to the htaccess file in your document root:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^subdomain\.site\.com$ [NC]
RewriteRule ^client/ - [L,F]

If you would rather return a 404 instead of a 403 (forbidden) then change the stuff in the square brackets to: [L,R=404]

Upvotes: 1

Related Questions