Re: mod_rewrite and location

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx> 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="" [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@xxxxxxxxxxxxxxxx
 "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux