PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > alt.apache.configuration > modrewrite and text files
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
alt.apache.configuration Apache web server configuration issues.

modrewrite and text files

Réponse
 
LinkBack Outils de la discussion
Vieux 09/05/2007, 14h53   #1
Jon Slaughter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut modrewrite and text files


#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


  Réponse avec citation
Vieux 09/05/2007, 15h42   #2
shimmyshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: modrewrite and text files

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>


  Réponse avec citation
Vieux 09/05/2007, 16h50   #3
Joshua Slive
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: modrewrite and text files

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?

  Réponse avec citation
Vieux 09/05/2007, 17h55   #4
shimmyshack
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: modrewrite and text files

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

  Réponse avec citation
Vieux 09/05/2007, 18h28   #5
Jon Slaughter
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: modrewrite and text files


"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


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 00h37.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10693 seconds with 13 queries