维护页面,无需重定向到错误页面

时间:2021-02-14 01:54:56

I have to make a maintenance page for my website with the htaccess, I've searched on the internet and could only find snippets/scripts which redirect but I only want that it displays a message on the page itself for people, but not for a specified ip-adres. So when I enable the script in the htaccess it has to show a message on every page/ file(=css, etc.) except for my ip-adres

我必须使用htaccess为我的网站制作一个维护页面,我在互联网上搜索,只能找到重定向的片段/脚本,但我只想在页面上为人们显示一条消息,但不是为了指定的ip-adres。因此,当我在htaccess中启用脚本时,它必须在每个页面/文件(= css等)上显示一条消息,除了我的ip-adres

Thanks, Sake

1 个解决方案

#1


1  

This should work.

这应该工作。

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !=123.45.67.89
RewriteRule ^ /construction.php [R=301,L]

EDIT:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !=123.45.67.89
RewriteCond %{REQUEST_URI} !^/construction.php
RewriteRule ^ /construction.php [L]

#1


1  

This should work.

这应该工作。

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !=123.45.67.89
RewriteRule ^ /construction.php [R=301,L]

EDIT:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !=123.45.67.89
RewriteCond %{REQUEST_URI} !^/construction.php
RewriteRule ^ /construction.php [L]