skip to Main Content

I am trying to restrict my ip via .htaccess file it is working fine in without RewriteRule .* index.php [L] i am quite confusing here and waste my whole day to solve this problem i tried the deny statement even at the begging of the file and at the end of every other htaccess statement. i mentioned my code below please help me to solve this problem.

DirectoryIndex index.php
<IfModule mod_php5.c>
    php_value memory_limit 256M
    php_value max_execution_time 18000
    php_flag magic_quotes_gpc off
    php_flag session.auto_start off
    php_flag suhosin.session.cryptua off
    php_flag zend.ze1_compatibility_mode Off
</IfModule>
<IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
</IfModule>
<IfModule mod_deflate.c>

</IfModule>
<IfModule mod_ssl.c>
    SSLOptions StdEnvVars
</IfModule>


<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule ^api/rest api.php?type=rest [QSA,L]
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
    RewriteRule .* - [L,R=405]

    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            Header set X-Content-Type-Options: nosniff
            BrowserMatch bMSIEs8 ie8
            Header set X-XSS-Protection: "1; mode=block" env=!ie8
        </IfModule>
    </IfModule>

    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule .* index.php [L] # When i comment this line the below code works fine but with this line i am unable to limit the site.

</IfModule>

Order deny,allow
Allow from all
Deny from 110.93.244.176

2

Answers


  1. Chosen as BEST ANSWER

    After a lot of research and pseudo code finally i found the problem the problem was Apache version i guess i just change the the code

    from

    Order deny,allow
    Allow from all
    Deny from 110.93.244.176
    

    to

    <RequireAll>
        Require all granted 
        Require not ip 110.93.244.176
    </RequireAll>
    

    Hope this will work for someone else.


  2. The context is not clear for mé. Anyway, remove line Allow from all and try again.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search