- Posts: 55
- Thank you received: 9
Restrict access to urls > zip Files
- Peter Kuhlmann
- Topic Author
- Offline
- Senior Member
-
Less
More
6 years 9 months ago #115550
by Peter Kuhlmann
Restrict access to urls > zip Files was created by Peter Kuhlmann
Hi everyone,
I want to restrict my zip Files which are password protected with htaccess in a folder.
But if the user knows the Url how it is protected then?
I want to restrict my zip Files which are password protected with htaccess in a folder.
But if the user knows the Url how it is protected then?
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
6 years 9 months ago #115553
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Restrict access to urls > zip Files
Hi Peter
Your question is not very clear to me. So you want to restrict access this file and only want to allow your subscribers (who paid for your subscription plans) to access to it but other users cannot?
If so, it's not possible. The reason is because there is no way for Membership Pro to protect a static resource like that (direct link to a file). Membership Pro can only protect pages generated by Joomla (like articles, categories....)
Tuan
Your question is not very clear to me. So you want to restrict access this file and only want to allow your subscribers (who paid for your subscription plans) to access to it but other users cannot?
If so, it's not possible. The reason is because there is no way for Membership Pro to protect a static resource like that (direct link to a file). Membership Pro can only protect pages generated by Joomla (like articles, categories....)
Tuan
Please Log in or Create an account to join the conversation.
- Jonathan Colls
- Offline
- Senior Member
-
Less
More
- Posts: 57
- Thank you received: 5
6 years 9 months ago #115732
by Jonathan Colls
Replied by Jonathan Colls on topic Restrict access to urls > zip Files
We use HTACCESS in the applicable folder to restrict access only to visitors that have a referrer of the site domain. This means they have to visit from another page on the site which you can control access to. If they go directly to the file then they get redirected back to the initial page which checks their permissions.
I believe it is not 100% fool proof as users can spoof the referrer but it works well in our case.
I believe it is not 100% fool proof as users can spoof the referrer but it works well in our case.
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
-
6 years 9 months ago #115818
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Restrict access to urls > zip Files
Hello Janathan
Could you please share the htaccess file which you are using? It might be useful for other customers
I am not good at htaccess rules but maybe I can understand your setup and guide customers in the future if someone needs it
If you share it, please zip the htaccess file before uploading, otherwise, it will be blocked by our server
Regards,
Tuan
Could you please share the htaccess file which you are using? It might be useful for other customers
I am not good at htaccess rules but maybe I can understand your setup and guide customers in the future if someone needs it
If you share it, please zip the htaccess file before uploading, otherwise, it will be blocked by our server
Regards,
Tuan
Please Log in or Create an account to join the conversation.
- Peter Kuhlmann
- Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 55
- Thank you received: 9
6 years 9 months ago #115995
by Peter Kuhlmann
Replied by Peter Kuhlmann on topic Restrict access to urls > zip Files
- Jonathan Colls
- Offline
- Senior Member
-
Less
More
- Posts: 57
- Thank you received: 5
6 years 9 months ago #115997
by Jonathan Colls
Replied by Jonathan Colls on topic Restrict access to urls > zip Files
Hi There,
This is the code in the htaccess file we use.
# Only allow access to this directory if they are coming from your domain.
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https://(www\.)?yourdomain\.co\.uk/ [NC]
RewriteRule .*\.(php)$ www.yourdomain.co.uk/deniedaccess/url [NC]
#END
Note, the above code only captures php files so you will need to change that to ZIP or whatever extension you want to restrict. Obviously you need to change to your domain as well. As mentioned, this is not foolproof but works well for our needs.
Hope this helps
This is the code in the htaccess file we use.
# Only allow access to this directory if they are coming from your domain.
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https://(www\.)?yourdomain\.co\.uk/ [NC]
RewriteRule .*\.(php)$ www.yourdomain.co.uk/deniedaccess/url [NC]
#END
Note, the above code only captures php files so you will need to change that to ZIP or whatever extension you want to restrict. Obviously you need to change to your domain as well. As mentioned, this is not foolproof but works well for our needs.
Hope this helps
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.