Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用htaccess将网站访问限制为仅限于几个网页和ip地址_Php_.htaccess_Mod Rewrite - Fatal编程技术网

Php 如何使用htaccess将网站访问限制为仅限于几个网页和ip地址

Php 如何使用htaccess将网站访问限制为仅限于几个网页和ip地址,php,.htaccess,mod-rewrite,Php,.htaccess,Mod Rewrite,使用下列 Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_URI} !/temp_page.php$ RewriteCond %{REQUEST_URI} !/thanks.php$ RewriteCond %{REMOTE_HOST} !^90\.333\.222\.111 #RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1 RewriteRule $ /temp_page.p

使用下列

Options +FollowSymlinks
RewriteEngine on

RewriteCond %{REQUEST_URI} !/temp_page.php$
RewriteCond %{REQUEST_URI} !/thanks.php$

RewriteCond %{REMOTE_HOST} !^90\.333\.222\.111
#RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1

RewriteRule $ /temp_page.php [R=302,L]
可以允许自己(ip)查看所有页面,其他人只能查看temp_页面和Thanke.php。我在temp_页面和Thanke.php上链接了图像和css文件,但它们不起作用,我如何修改RewriteCond,使其允许/js/、/css/、和/images/。也一样

如果需要更多信息,请告诉我

谢谢。

添加

RewriteCond %{REQUEST_URI} !\.css$
RewriteCond %{REQUEST_URI} !\.js$
RewriteCond %{REQUEST_URI} !^/images/
应该有用