.htaccess 使用htaccess访问某些文件夹和字体

igsr9ssn  于 2023-05-01  发布在  其他
关注(0)|答案(1)|浏览(109)

我有一个代码,以重定向所有用户很快。php除了那些与某些页面应该看到的内容。htaccess ..
代码如下所示:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !=10.10.10.10
RewriteCond %{REQUEST_URI} !^/soon\.php$
RewriteRule ^(.*)$ http://example.com/soon.php [R=307,L]

但当我看不久。php的图像和字体是失踪的,这是位于另一个子文件夹名为

/soon/images
/soon/fonts

我怎么能很快给予。php哪个是在根目录下访问那些目录的?

jqjz2hbq

jqjz2hbq1#

尝试排除具有特定referer的请求:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !=10.10.10.10
RewriteCond %{REQUEST_URI} !^/soon\.php$
RewriteCond %{HTTP_REFERER} !soon\.php
RewriteRule ^(.*)$ http://example.com/soon.php [R=307,L]

或者,只排除/soon/目录:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !=10.10.10.10
RewriteCond %{REQUEST_URI} !^/soon\.php$
RewriteCond %{REQUEST_URI} !^/soon/
RewriteRule ^(.*)$ http://example.com/soon.php [R=307,L]

相关问题