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

发布于 2024-09-07 12:13:30 字数 510 浏览 1 评论 0原文

使用以下

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_page和thanks.php。我在 temp_page 和thanks.php 上链接了图像和css 文件,但它们不起作用,如何修改 RewriteCond 以便它允许 /js/.、/css/. 和 /images/. 以及?

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

谢谢。

Using following

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]

can allow myself (ip) to view all pages, and other get to view only temp_page and thanks.php. I've images and css files linked on temp_page and thanks.php but they dont work, how do I modify RewriteCond so that it allows /js/., /css/., and /images/. as well??

please let me know if need more info.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半枫 2024-09-14 12:13:30

添加

RewriteCond %{REQUEST_URI} !\.css$
RewriteCond %{REQUEST_URI} !\.js$
RewriteCond %{REQUEST_URI} !^/images/

应该有效。

Adding

RewriteCond %{REQUEST_URI} !\.css$
RewriteCond %{REQUEST_URI} !\.js$
RewriteCond %{REQUEST_URI} !^/images/

should work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文