Monday 15 June 2015

block specific url in .htaccess and allow access by IP -


I have a problem, I want to secure the admin panel of my website using .htaccess, but its CGI script .

looks so Vebbraujr:

The course is /cgi-bin/index.cgi?op=adminpanel

I tried: < / Strong>

    

But not working, works when I use & lt; Files index.cgi & gt; & Lt; / Files & gt; But for everyone except for the entire site, I received a 403 error my IP

Now I am testing with:

  RewriteCond% {REMOTE_ADDR} on RewriteEngine (my.IP) RewriteCond% {} QUERY_STRING << Code>  

would be greatly appreciate any help text "itemprop =" text ">

You can do this by:

Assume that you want to block the 123.255.123.255 IP address by reaching the page to www.mydomain.com/index.php.? Option = com_my_special_component. You can write rules in the following ways Interpretation is:

  RewriteCond% {RewriteEngine on REMOTE_ADDR} ^ 123 \ .255 \ .123 \ .255 RewriteCond% {QUERY_STRING} option = com_my_special_component [NC] RewriteRule ^ (. *) $ Index .php [F, L]   

The first line simply changes the URL to the rewrite. The second line matches the IP address (use the backslash before each dot), the third The line matches the query string (i.e. anything coming after URL?) - in this case it will be a match if option = com_my_special_component says in the URL Comes after? (Like index.php? Id = 1 & option = com_my_special_component and action = dostuff will still match this rule). At the end of that line [NC] asks to implement this rule that if any of the characters in the URL are uppercase or lowercase or not The last line redirects to index.php with a 'forbidden' title - So that they will get an error message in their browser, and mod_rewrite tells you to prevent the interpretation of any further re-write rules

You can restrict many IP addresses you want, to add new lines, but you need to add [OR] flag at the end of each line except the last line - for example:

  RewriteEngine on RewriteCond% {REMOTE_ADDR} ^ 123 \. 255 \ .123 \ .255 [or] Rewrite% {REMOTE_ADDR} ^ 124 \ .255 \ .124 \ .255 [Y ] Rewrite% {REMOTE_ADDR} ^ 125 \ .255 \ .125 \ .255 Riwait condoms% {QUERY_STRING} option = Com_me_svisl_companent [NC] Riraitrebl ^ (. *) $ Index.php [F, L]   

Since you are using block on any admin page, you probably only want to allow your IP, in that case you can only put an exclamation mark in front of the IP address, to say whether It has to be rewritten in addition to any other IP.

 % {REMOTE_ADDR} to rewrite the rewrite! ^ 123 \ .255 \ .123 \ .255 rewrite% {REMOTE_ADDR}! ^ 124 \ .255 \ .124 \ .255 rewrite% {REMOTE_ADDR}! ^ 125 \ .255 \ .125 \ .255 RewriteCond% {QUERY_STRING} option = com_my_special_component [NC] RewriteRule ^ (. *) $ Index.php [F, L]   

hope That helps

No comments:

Post a Comment