Hey everyone,
I am just changing an htaccess file i wrote a while ago and am not sure if you're actually able to do what i want to, i'm not sure how 🙂
I have an htaccess file (obviously containing the real variables!) which works fine:
AuthType Basic
AuthName "access"
AuthMYSQLhost localhost
AuthMYSQLuser user
AuthMySQLPassword pass
AuthMySQLDB db
AuthMySQLUserTable table
AuthMySQLNameField FUsername
AuthMySQLPasswordField FPassword
AuthMySQLGroupTable TSubscription
AuthMySQLGroupField FAccessSection
AuthMySQLEnable On
AuthMySQLPwEncryption none
require group xxx
At the moment i use this to protect files so i have for example 3 folders, 1, 2 and 3 and users can be members of groups 1 and/or 2 and/or 3 and this is listed in the TSubscription table. Within each of the folders i have the same htaccess file but with the require group listed as 1, 2 or 3 depending on the folder. Each of these folders have one zip files inside also called 1.zip, 2.zip or 3.zip.
Obviously this is a silly way of doing it as it duplicates data and uses unecessary space, so what i want to do is put them all in one folder with one htaccess file that will pull the require group variable from the url and apply that.
Eg someone wants file 3.zip (accessed via url download.php?download=3) then i want the htaccess file to find the variable 3 from the url and then use that within the require group line.
Problem is i can't work out how to take a url variable into htaccess? I can get variables from it within a rewrite rule eg
RewriteRule (.*)mysite.com/([/]+)?$ $1dave/index.php?profileusername=$2 [NC,QSA,L]
But i have no idea and can't find any reference to doing the same thing in terms of taking the url variables and then using variable $2 (or whatever) with in the group require line (eg require group $2).
I hope i have explained myself properly, it's quite confusing so if i haven't made anything clear then please ask. I would really, really appreciate any pointers anyone could give me on this as it is driving me crazy!!!!
Thanks very much everyone, look forward to hearing from you!
Dave