logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: mod_rewrite and location
Author
gemal



Joined: 19 Mar 2010
Posts: 1
Location: Copenhagen

PostPosted: Fri 19 Mar '10 11:03    Post subject: mod_rewrite and location Reply with quote

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

Help1
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 13 Apr '10 16:46    Post subject: Re: mod_rewrite and location Reply with quote

gemal wrote:

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

Help1


Nope, I guess that that from your deny rule. See the error log. What is in your log file about that?
Back to top


Reply to topic   Topic: mod_rewrite and location View previous topic :: View next topic
Post new topic   Forum Index -> Apache