|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Apache - Directory / File Regexps
Yup, its another reg exp issue :p
I'm trying to restrict access to all folder except one for anyone but me accessing my server. Im trying to put a regexp in the <directory> tag. But I'm not sure how to get the expression for this one. What I've come up with seems only to hide the folder, rather than show only that one. Is it possible to use an operator like ! or something for does not equal? Havent been able to find the right order with my messing around.
__________________
~~==~~ Whoever said nothing is impossible never tried pushing a revolving door ~~==~~ |
|
#2
|
|||
|
|||
|
Take a look here, I think it will help - also with all of the 'expert-exchange' pages you have to scroll all the way down to the bottom of the page (it takes a little while to load the whole thing) to get to the actual resolutions instead of the ones that say 'sign-up' or whatever.
http://www.experts-exchange.com/Sof...Q_23352102.html
__________________
Sir, a desire of knowledge is the natural feeling of mankind; and every human being, whose mind is not debauched, will be willing to give all that he has to get knowledge. |
|
#3
|
|||
|
|||
|
do you mean when you are accessing your server locally? you could just put another .htaccess in that folder with something simple like:
Code:
order deny,allow deny from all allow from 127.0.0.1 .htaccess files in subfolders take precedence over the .htaccess in the parent folders. I use this to deny access to my include, class and module folders. |
|
#4
|
|||
|
|||
|
No, from externally.
If you put something like <Files "Audio"> Order,deny allow Deny from all </Files> in httpd.conf it will block all users from seeing any file or folder where it reg exp matches "Audio" to any file/folder name. However I want the opposite to occur. It should block every file/folder from view, apart from my Audio folder in the directory root. And rather than enter a seperate <file> and <folder> entry for every other folder in the directory |
|
#5
|
|||
|
|||
|
Would you just need two? I'm not very good with .htaccess files, but from what Llama says- it seems like you would only need one in the root and then one in the Audio folder - Audio folder allow and root deny...
|
|
#6
|
|||
|
|||
|
maybe, I'll try later, see if that does what I'm after
|
|
#7
|
|||
|
|||
|
yes, if you wanted to deny access to the root and allow to the audio you should be able to just use two .htaccess, one with deny from all in the root and one with allow from all in /audio/
|
|
#8
|
|||
|
|||
|
The only problem with that way is that when I go to root it just shows the "You don't have permission to access / on this server." error. However If I manually go to localhost/audio then I get access.
What I am trying to do is have this happen, this is without an changes to the httpd.conf file. Index of / * Andy Stuff/ * Audio/ * Basic Test/ * Codewalkers/ * Dungeon Master/ * Mail Tests/ * Misc/ * Temp/ * XML/ * phpinfo.php * pulse_fw3324.exe and this is what Im trying to do have happen is to get Index of / * Audio/ for all users but me, I know I can put a .ht access in every other folder to establish this, but Im sure it could be done in the .conf file instead |
|
#9
|
|||
|
|||
|
Ok, getting somewhere now, what I have done is put in
<Directorymatch "^(D:/Olympus/PHP Files/)[B-Z]"> order deny,allow deny from all </Directorymatch> and <Files "index.html"> order deny,allow allow from all </Files> The second cos otherwise I can't access the server generally. The first one blocks all folders which don't begin with A (for Audio). Now Im trying to get it to go on the second letter so I've tried adding [a-t|v-z] allowing u (the second letter of Audio). But that doesn't work for some reason, infact it seems to bring back an entry with u as the second entry. I presume becuase the reg exp keeps running through the expression for other matches? |
|
#10
|
|||
|
|||
|
ok, not quite sure why this works but it does
<Directorymatch "^(D:/Olympus/PHP Files/).{4}[^(o)]"> thankfully Audio is the only folder with o as the fifth letter in the directory |
|
#11
|
|||
|
|||
|
why can't you just use:
<Directorymatch "^D:/Olympus/PHP Files/audio"> |
|
#12
|
|||
|
|||
|
That just blocks the audio folder, whereas I am trying to block everythingb but the audio file
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > Apache - Directory / File Regexps |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|