如何将所有网络流量重定向到特定页面? [英] How to redirect all web traffic to a specific page?

查看:71
本文介绍了如何将所有网络流量重定向到特定页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法将我网站的所有流量重定向到特定页面?我的免费主机支持 PHP.不确定这是否适合于此.谢谢.

Is there a way to redirect all traffic to my website to a specific page? My free host does support PHP. Not sure if that is what would be appropriate for this or not. Thank you.

推荐答案

如果您的主机基于 Apache 并支持 mod_rewrite,使用那个.例如.wordpress 典型的重写,将请求重定向到不存在的文件/文件夹到 index.php,传递原始 URL:

If your host is based on Apache and supports mod_rewrite, use that. Eg. the wordpress typical rewite, that redirects requests to non-existing files/folders to index.php, passing on the original URL:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

这篇关于如何将所有网络流量重定向到特定页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆