gpt4 book ai didi

apache - 使用 .htaccess 重定向

转载 作者:行者123 更新时间:2023-12-04 07:08:28 24 4
gpt4 key购买 nike

我想将所有用户页面请求重定向到同一域上的页面。

例如,我有一个“正在 build 中,BRB”页面,我希望所有用户在尝试访问网站上的任何页面时都能看到该页面。

我尝试使用这个:

Redirect 302 / http://www.domain.com/index2.php

这样做是尝试将重定向也应用于 index2.php 页面,它会卡在一个循环中,然后用户会看到它,直到浏览器停止。
http://www.domain.com/index2.phpindex2.phpindex2.phpindex2.php etc., etc,

关于如何将该规则写入该页面之外的任何想法?

最佳答案

您必须排除要重定向到的文件。这是一个使用 mod_rewrite 的例子:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule !^index2\.php$ /index2.php [L,R=302]
</IfModule>

关于apache - 使用 .htaccess 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/744087/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com