如何重定向到另一个文件但保留 index.php 访问权限
我将尝试用我能想到的最简单的术语来解释这一点,以避免让任何人感到困惑。
我有一个网站已移至子目录,它很快就会消失,但需要访问。在根目录中,我安装了一个带有index.php 文件的wordpress。
基本上目前我需要这个:
用户输入 www.site.com 他们会被带到 www.site.com/comingsoon.php 用户输入 www.site.com/index.php 他们会被带到实际的 URL(无重定向)
这是我的 .HTACCESS 中唯一的一行:
目录索引comingsoon.php
但这似乎不起作用,就像他们访问 www.site.com/index.php (通过明确输入)一样,他们仍然会被重定向到即将推出的页面。
我无法从 WordPress 重命名 index.php。
任何帮助表示赞赏。
I will try to explain this in the simplest terms I can think to avoid confusing anyone.
I have a site that I've moved to a subdirectory, it will go away soon but for needs access. In the root I have a wordpress install with an index.php file.
Basically for the time being I need this:
User types www.site.com they get taken to www.site.com/comingsoon.php
User types www.site.com/index.php they get taken to that actual URL (no redirect)
This is the only line I have in my .HTACCESS:
DirectoryIndex comingsoon.php
but that doesn't seem to work as if they go www.site.com/index.php (by typing that explicitly) they still get redirected to the coming soon page.
I can't rename the index.php from wordpress.
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的 .htaccess 文件中尝试此代码:
这只会在内部将
www.site.com
或www.site.com/
重定向到/comingsoon.php.但如果您输入
www.site.com/index.php
它不应该执行任何重定向。Try this code in your .htaccess file:
This will only internally redirect
www.site.com
orwww.site.com/
to/comingsoon.php
. But if you typewww.site.com/index.php
it should not do any redirection.