简体   繁体   中英

.htaccess and subdomain folder

my .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?my-site.com$ [NC]
RewriteCond %{REQUEST_URI} ^/my-subdomain/(.*)$
RewriteRule ^(.*)$ - [L,R=404] 

when I access to: http://my-site.com/my-subdomain/ it works, the folder is locked.

but when I access to: http://my-site.com/my-subdomain/img/101.jpg It does not work, I can access the image.

how can I deny the access to any image or image folder?

Those rules you have should work, make sure that your image isn't cached. Clear you cache and try again.

You can also consolidate your rules:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^(www.)?my-site.com$ [NC]  
RewriteRule ^my-subdomain/ - [L,R=404] 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM