试图弄清楚如何阻止IP访问一个网站以外的IP。
RewriteCond %{REMOTE_ADDR} = x.x.x.x [NC]
RewriteCond %{REQUEST_URI} !^/url/moreurl/ [NC]
RewriteRule .* - [R=404,L]
现在看来,它阻止了一切。
编辑:
# Set our application environment
SetEnv ENVIRONMENT beta
SetEnvIf Origin "^http(s)?://(.+\.)?(somedomain.com|somedomain2.com)$" origin_is=$0
Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
Header set Access-Control-Allow-Credentials true
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RedirectMatch 404 ^/symfony/?$
RedirectMatch 404 ^/system/?$
RedirectMatch 404 ^/db/?$
RedirectMatch 404 ^/application/?$
RedirectMatch 404 ^/vendor/?$
RedirectMatch 404 ^/queue_workers/?$
RedirectMatch 404 ^/crons/?$
RedirectMatch 404 ^/[^/]\.(yml|json|lock)$
# Allow IP to Specific URL (TESTING - works until adding ! to REQUEST_URI)
RewriteCond %{HTTP:X-FORWARDED-FOR} ^123\.123\.123\.123
RewriteCond %{REQUEST_URI} !\s/url[NC]
RewriteRule ^ - [F]
# End of the line -- static files & directories, or otherwise pass into CI frontend controller
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
尝试使用此规则,THE_REQUEST
因为REQUEST_URI
其他规则可能会更改:
RewriteCond %{REMOTE_ADDR} = x.x.x.x
RewriteCond %{THE_REQUEST} !\s/url/moreurl/ [NC]
RewriteRule ^ - [F]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句