Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 79369 invoked from network); 29 Mar 2010 09:58:27 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Mar 2010 09:58:27 -0000 Received: (qmail 85621 invoked by uid 500); 29 Mar 2010 09:58:24 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 85437 invoked by uid 500); 29 Mar 2010 09:58:23 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 85428 invoked by uid 99); 29 Mar 2010 09:58:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Mar 2010 09:58:23 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of hege@mail.dk designates 195.41.46.226 as permitted sender) Received: from [195.41.46.226] (HELO fep43.mail.dk) (195.41.46.226) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Mar 2010 09:58:15 +0000 X-TDCCM: v=1.1 cv=yYEgzb/ml1BU1u+oEr1iXFcsqab8+Md1x8XgQUhdWkY= c=1 sm=0 a=60b2mY-ol2IA:10 a=Ow0SQlAsPkdqcqKO6JQSdA==:17 a=mV9VRH-2AAAA:8 a=np-hDluwa48s6DY_x6EA:9 a=o4NgT0KpUfdF9lUOSfcA:7 a=WvJQjECKXcEKoUCtzGTFS0gCUucA:4 a=wPNLvfGTeEIA:10 a=BSNjd8G5NXsA:10 a=pGLkceISAAAA:8 a=X-ScPMN5nVoTFaIigfMA:9 a=7-4ZtoRKRg7R1AjYjcwA:7 a=pr8QbyrAtFxi4AN1F_m8auAlru0A:4 a=Ow0SQlAsPkdqcqKO6JQSdA==:117 X-TDCLU: NjAwMDIw Received: from [87.63.224.162] ([87.63.224.162:11242] helo=[10.3.1.21]) by fep43.mail.dk (envelope-from ) (ecelerity 2.2.2.45 r()) with ESMTPA id EB/D9-19130-1A970BB4; Mon, 29 Mar 2010 11:57:54 +0200 Message-ID: <4BB0799E.8070201@mail.dk> Date: Mon, 29 Mar 2010 11:57:50 +0200 From: Henrik Gemal User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.3a4pre) Gecko/20100328 Shredder/3.2a1pre MIME-Version: 1.0 To: users@httpd.apache.org References: <4BB0718C.1010605@mail.dk> In-Reply-To: Content-Type: multipart/alternative; boundary="------------050305090405010909050302" X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [users@httpd] mod_rewrite and location --------------050305090405010909050302 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit The problem is that if I do: Order deny,allow Deny from all Order deny,allow Allow from all Order deny,allow Deny from all Allow from 127.0.0.1 then calling http://localhost/index.php/program2 would access program2 when he shouldn't On 29-03-2010 11:42, Igor Cicimov wrote: > > Your RewriteRule is wrong redirects everything to index.php in the > root directory where you dont have access > >> On Mar 29, 2010 8:24 PM, "Henrik Gemal" > > wrote: >> >> I use mod_rewrite and in the root of the website I have this in the >> .htaccess file: >> >> >> RewriteEngine On >> RewriteCond %{REQUEST_FILENAME} !-d >> RewriteCond %{REQUEST_FILENAME} !-f >> RewriteRule ^(.*)$ index.php?url=$1 [qsappend,last] >> >> >> My index.php is simple: >> >> >> My URLs are something like this: >> http://localhost/program1/info >> http://localhost/program2/info >> >> Now I want to restrict the access to /program2 to certain IP. >> >> I've tried: >> >> Order deny,allow >> Deny from all >> >> >> Order deny,allow >> Allow from all >> >> >> Order deny,allow >> Allow from 127.0.0.1 >> >> >> But it doesn't work >> >> If I try to load http://localhost/program2 I get: >> "You don't have permission to access /index.php on this server." >> >> So it had something to do with mod_rewrite >> >> Help >> >> --------------------------------------------------------------------- >> The official User-To-User support forum of the Apache HTTP Server >> Project. >> See for more info. >> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org >> >> " from the digest: users-digest-unsubscribe@httpd.apache.org >> >> For additional commands, e-mail: users-help@httpd.apache.org >> >> --------------050305090405010909050302 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit The problem is that if I do:

    <Location />
        Order deny,allow
        Deny from all
    </Location>
    <Location /index.php>
        Order deny,allow
        Allow from all
    </Location>
    <Location /program2>
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1
    </Location>

then calling http://localhost/index.php/program2 would access program2 when he shouldn't

On 29-03-2010 11:42, Igor Cicimov wrote:

Your RewriteRule is wrong redirects everything to index.php in the root directory where you dont have access

On Mar 29, 2010 8:24 PM, "Henrik Gemal" <hege@mail.dk> wrote:

 I use mod_rewrite and in the root of the website I have this in the .htaccess file:

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^(.*)$ index.php?url=$1 [qsappend,last]
</IfModule>

My index.php is simple:
<?php echo "hello"; ?>

My URLs are something like this:
http://localhost/program1/info
http://localhost/program2/info

Now I want to restrict the access to /program2 to certain IP.

I've tried:
<Location />
  Order deny,allow
  Deny from all
</Location>
<Location /program1>
  Order deny,allow
  Allow from all
</Location>
<Location /program2>
  Order deny,allow
  Allow from 127.0.0.1
</Location>

But it doesn't work

If I try to load http://localhost/program2 I get:
"You don't have permission to access /index.php on this server."

So it had something to do with mod_rewrite

Help

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
 "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

--------------050305090405010909050302--