WordPress 初始页面带有 htaccess?
我在根目录中设置了一个 WordPress 网站。我需要设置一个临时启动页面来宣传带有“输入”按钮的专辑,该按钮将引导至常规网站。我知道有一种方法可以通过将文件移动到不同的目录来做到这一点,但我不想这样做。有没有更简单的方法可以使用 htaccess 来做到这一点?或者其他更简单的方法?
I have a WordPress site set up in the root. I need to set up a temporary splash page to promote an album with an 'enter' button which will lead to the regular site. I know there is a way to do this by moving files to different directories but I'd rather not do that. Is there a simpler way to do this perhaps with htaccess? Or another simpler method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
很简单。
在您的
htaccess
文件中添加DirectoryIndex flash.php blog.php
。在根目录中添加 splash.php 文件。在此文件中添加启动页面代码。
复制
index.php
文件并将新文件重命名为blog.php
登录 wp-admin,转到
setting ->;常规设置
更改站点地址(URL)值,应该是
http://www.yoursite.com/blog.php
就这样!!!!
Quite simple.
add
DirectoryIndex splash.php blog.php
in yourhtaccess
file.add
splash.php
file in your root directory. add splash page code in this file.copy
index.php
file and rename new file with nameblog.php
Login in wp-admin, Go to
setting -> General Settings
Change Site address (URL) value, it should be
http://www.yoursite.com/blog.php
That's it!!!!
您可以执行此操作的另一种方法是检测 HTTP_REFERER 并向您的 index.php 添加条件语句。这样,客户端计算机只会在输入根 URL 时看到启动画面(而不是通过刷新或单击主页)。
示例代码
确保您的 WordPress 注释块位于页面顶部。
不需要 .htaccess 周。
Another way you can do this is to detect the HTTP_REFERER and add a conditional statement to your index.php. This way client machines will only see the splash when entering in the root url (not by refreshing or clicking home).
Sample code
Make sure you have the wordpress comment block on the top of the page.
No .htaccess tweeks needed.
我是这样使用的,到目前为止效果很好。从我的index.php中删除了其他内容(不是从主题中而是从wordpress本身)并将其留在这里:
当然,您必须根据自己的URL更改域,并且需要在您的顶级wordpress中有一个splash.html文件文件夹。
希望这对某人有帮助:)
I used it like this and it works good, so far. Deleted the other stuff from my index.php (not from the theme but from wordpress itself) and left this here:
Of course you will have to change the domain against your own URL and need to have a splash.html file in your top wordpress folder.
Hope this helps somebody :)