Google Answers Logo
View Question
 
Q: Apache (2.0) mod_rewrite ( No Answer,   1 Comment )
Question  
Subject: Apache (2.0) mod_rewrite
Category: Computers > Programming
Asked by: capitalcitydesign-ga
List Price: $5.00
Posted: 29 Jul 2006 15:22 PDT
Expires: 28 Aug 2006 15:22 PDT
Question ID: 750712
How do I block access to a specific page using Apache (2.0)
mod_rewrite in an .htaccess file. I have the following already:

# Append "/home" to called section if not there.
RewriteRule ^(public|alumni|admin)/?$ /$1/home [R=permanent,L]
# Remove trailing slash from request.
RewriteRule ^(public|alumni|admin)/(.*)/$ /$1/$2 [R=permanent,L]
# Send to section's processing page.
RewriteRule ^(public|alumni|admin)/(.*)$ $1.php [L]

If I use this, IE returns "Page can not be displayed":

# Block direct access to processing pages.
RewriteRule ^(public|alumni|admin).php /$1/home [R=permanent,L]

Request for Question Clarification by sycophant-ga on 31 Jul 2006 03:06 PDT
Hi, 

I am not clear on what you are asking?

The rule you provide is already blocking access? How do you want this
to be different?

What is the page/file you are trying to block? 
Under what conditions (if any) do you want it accessible?

Regards,
Sycophant
Answer  
There is no answer at this time.

Comments  
Subject: Re: Apache (2.0) mod_rewrite
From: pilgrimx182-ga on 01 Aug 2006 23:24 PDT
 
I've played with these rewrites and it looks the problem is inside this rule:

# Send to section's processing page.
RewriteRule ^(public|alumni|admin)/(.*)$ $1.php [L]

rewrites cycling till cycle limit reached and error happened. Somehow
[L] doesn't help. Try to make this rewrite rule more specific to avoid
cycling. And probably you should use '\.php' instead of '.php' in the
last rule.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy