|
|
|
|
||||||
| alt.apache.configuration Apache web server configuration issues. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
#Prevent access to scripts dir RewriteRule ^Scripts - [F,L,NC] I'm trying to prevent access to several dirs using stuff like whats above. THe problem is that no matter what I do, even if I specifically tell rewrite not to allow text files it still does. the file I'm trying to prevent is /Scripts/links.txt and if I use the rule RewriteRule ^/?Scripts/links.txt - [F,L,NC] Then it still gives access. Seem to me that mod rewrite does not in any way pass long uri's that are to text files? If I change everythign to php or some other ext then it works fine. Thanks, Jon |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On May 9, 2:53 pm, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote:
> #Prevent access to scripts dir > RewriteRule ^Scripts - [F,L,NC] > > I'm trying to prevent access to several dirs using stuff like whats above. > THe problem is that no matter what I do, even if I specifically tell rewrite > not to allow text files it still does. > > the file I'm trying to prevent is > > /Scripts/links.txt > > and if I use the rule > > RewriteRule ^/?Scripts/links.txt - [F,L,NC] > > Then it still gives access. Seem to me that mod rewrite does not in any way > pass long uri's that are to text files? If I change everythign to php or > some other ext then it works fine. > > Thanks, > Jon I would use RewriteRule \.txt$ - [F,L,NC] and rewrite doesnt care what mimetype the files are. but you know you could use <FilesMatch \.txt$> Order allow,deny </FilesMatch> |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On May 9, 9:53 am, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote:
> #Prevent access to scripts dir > RewriteRule ^Scripts - [F,L,NC] > > I'm trying to prevent access to several dirs using stuff like whats above. > THe problem is that no matter what I do, even if I specifically tell rewrite > not to allow text files it still does. > > the file I'm trying to prevent is > > /Scripts/links.txt > > and if I use the rule > > RewriteRule ^/?Scripts/links.txt - [F,L,NC] > > Then it still gives access. Seem to me that mod rewrite does not in any way > pass long uri's that are to text files? If I change everythign to php or > some other ext then it works fine. As always with mod_rewrite, you need to use the RewriteLog to see why your rules are not being matched. Perhaps they are not in the right part of the config file? |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On May 9, 4:50 pm, Joshua Slive <jsl...@gmail.com> wrote:
> On May 9, 9:53 am, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote: > > > > > #Prevent access to scripts dir > > RewriteRule ^Scripts - [F,L,NC] > > > I'm trying to prevent access to several dirs using stuff like whats above. > > THe problem is that no matter what I do, even if I specifically tell rewrite > > not to allow text files it still does. > > > the file I'm trying to prevent is > > > /Scripts/links.txt > > > and if I use the rule > > > RewriteRule ^/?Scripts/links.txt - [F,L,NC] > > > Then it still gives access. Seem to me that mod rewrite does not in any way > > pass long uri's that are to text files? If I change everythign to php or > > some other ext then it works fine. > > As always with mod_rewrite, you need to use the RewriteLog to see why > your rules are not being matched. Perhaps they are not in the right > part of the config file? joshuas right of course, set it to ReWriteLevel 9 while youre at it. You could just be chaining the rule with another that specifies things ending in .php |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
"shimmyshack" <matt.farey@gmail.com> wrote in message news:1178729727.580774.4120@l77g2000hsb.googlegrou ps.com... > On May 9, 4:50 pm, Joshua Slive <jsl...@gmail.com> wrote: >> On May 9, 9:53 am, "Jon Slaughter" <Jon_Slaugh...@Hotmail.com> wrote: >> >> >> >> > #Prevent access to scripts dir >> > RewriteRule ^Scripts - [F,L,NC] >> >> > I'm trying to prevent access to several dirs using stuff like whats >> > above. >> > THe problem is that no matter what I do, even if I specifically tell >> > rewrite >> > not to allow text files it still does. >> >> > the file I'm trying to prevent is >> >> > /Scripts/links.txt >> >> > and if I use the rule >> >> > RewriteRule ^/?Scripts/links.txt - [F,L,NC] >> >> > Then it still gives access. Seem to me that mod rewrite does not in any >> > way >> > pass long uri's that are to text files? If I change everythign to php >> > or >> > some other ext then it works fine. >> >> As always with mod_rewrite, you need to use the RewriteLog to see why >> your rules are not being matched. Perhaps they are not in the right >> part of the config file? > > joshuas right of course, set it to > ReWriteLevel 9 > while youre at it. > You could just be chaining the rule with another that specifies things > ending in .php > I tried doing this before but it would not generate the errors or I could not find out where the log file was. (wasn't the apache log files error.log and access.log) I think I got it all setup now. I'm not sure what I had before though but it now seems to be working. I'm having a little issue with hot linking but I think I can handle it. Thanks guys, Jon |
|
![]() |
| Outils de la discussion | |
|
|