亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

apache - .htaccess How to set IP whitelist permissions for a specific request?
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-05-16 17:04:32
0
1
1217

For example, http://demo.com/hello, I want to restrict access to only the IP address 211.125.10.5. Access from other IP addresses will return 403. How should I write .htaccess

PS1:
/hello is not a directory, so you cannot use .htaccess directory-based IP restrictions

PS2:
The website is based on WordPress and now has the following rewrite rules.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

PS3:
I just tried a solution, but it was always 500
This solution was rejected, the Location directive cannot be written in the .htaccess file...

<Location /hello/ >
	Order Deny,Allow
	Deny from all
	Allow from 211.125.10.5
</Location>
PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證0級(jí)講師

reply all(1)
僅有的幸福

Apache will search whether there is .htaccess in each directory, so you only need to set it in the subdirectory. The restriction method is the same as the main directory restriction.
Or don't use Location,使用Directory塊來限制,或者使用files to limit the executable file.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template