Forum Moderators: phranque

Message Too Old, No Replies

How to block user from single page

         

guillermo5000

9:47 pm on Sep 30, 2003 (gmt 0)

10+ Year Member



I use Limit and Mod_Rewrite to limit access in my .htaccess file, but I would like to prevent a user from accessing a single page. How can this be accomplished? Thanks.

jdMorgan

2:48 am on Oct 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



guillermo5000,

That depends on how you determine the speicific user. Having decided that, create a RewriteCond to detect the user, and use the page name in the RewriteRule.

Jim

guillermo5000

2:59 am on Oct 1, 2003 (gmt 0)

10+ Year Member



This is what I tried, but it doesn't seem to work...

RewriteCond %{REMOTE_ADDR} ^209\.26\.224\.45$
RewriteRule /industry.htm [f]

Do you see a problem? Thanks!

closed

4:08 am on Oct 1, 2003 (gmt 0)

10+ Year Member



I'm guessing the second line should be:

RewriteRule industry.htm - [F]

jdMorgan

4:17 am on Oct 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, there's a problem: You have no substitution (target URL or filepath) in the RewriteRule. You need either a valid substitution, or the special case "-" for use with [F] and [G] flags.

RewriteCond %{REMOTE_ADDR} ^209\.26\.224\.45$
RewriteRule /industry\.ht[b]m - [F][/b]

Also, all literal periods in regular-expressions patterns need to be escaped, as in "industry\.html". If this code is for use in .htaccess, you also may need to remove the leading slash from "/industry\.html" as well. It should work fine if you are using this code in httpd.conf.

Jim

guillermo5000

5:07 am on Oct 1, 2003 (gmt 0)

10+ Year Member



Ah! That works great! Thank you!

I know you have told me this before, but where can I read more about Mod_Rewrite?

Thanks again!

keyplyr

8:50 am on Oct 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



guillermo5000 - This [httpd.apache.org] is the link Jim always gives me :)

Also here. [httpd.apache.org]

guillermo5000

9:07 am on Oct 1, 2003 (gmt 0)

10+ Year Member



Thank you!