如何在htaccess和wordpress中中断重定向循环

如何在htaccess和wordpress中中断重定向循环,wordpress,.htaccess,Wordpress,.htaccess,我有一个wordpress网站,我想给它添加一个音乐播放器,这样音乐就不会被打断,访问者可以在不断地听音乐的同时浏览网站 我添加了两个iFrame:第一个加载他的网站,另一个加载音乐播放器。然后,我将两者都放入名为home.php的包装器中,并将以下规则添加到.htaccess文件中: DirectoryIndex home.php 因此包装器将从Wordpress加载,而不是index.php。home.php的代码如下: <iframe class="miMarco" src="in

我有一个wordpress网站,我想给它添加一个音乐播放器,这样音乐就不会被打断,访问者可以在不断地听音乐的同时浏览网站

我添加了两个iFrame:第一个加载他的网站,另一个加载音乐播放器。然后,我将两者都放入名为home.php的包装器中,并将以下规则添加到.htaccess文件中:

DirectoryIndex home.php

因此包装器将从Wordpress加载,而不是index.php。home.php的代码如下:

 <iframe class="miMarco" src="index.php"></iframe>
 <iframe src="audio/index.php" frameborder="0" width="230" height="70"></iframe>

这就是我所改变的一切

完整的.htaccess如下所示:

# Use PHP5 Single php.ini as default 
AddHandler application/x-httpd-php5s .php
DirectoryIndex home.php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
#使用PHP5 Single php.ini作为默认值
AddHandler应用程序/x-httpd-php5s.php
DirectoryIndex home.php
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
当我访问网站,home.php作为索引加载,然后它进入一个重定向循环时,问题就出现了,因为它不断加载音乐播放器,而从不加载wordpress站点


你知道为什么会这样吗?这是一个.htaccess问题还是wordpress问题?谢谢

您可以尝试让wordpress既不处理
home.php,也不处理
audio
。然后,您可以像排除
index.php
一样排除:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^home\.php$ - [L]
RewriteRule ^audio - [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
#开始WordPress
重新启动发动机
重写基/
重写规则^home\.php$-[L]
重写规则^audio-[L]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress

谢谢您的回答,我已经试过了,但它不起作用。我甚至尝试用DirectoryIndex替换名为splash的html文件。然后添加指令:
DirectoryIndex splash.html
和splash screen只包含一个指向“home.php”(带有两个iframe的包装器)的链接,但它不起作用。相反,home.php显示了音乐播放器和“单击此处”链接,尽管我的iframe看起来是这样的:
words:home.php正在加载:splash.html和audio/index.php,而不是加载index.php和audio/index。php@AlanChavez您是否尝试过删除
DirectoryIndex
行,并将
RewriteRule^$/home.php[L]
添加到您当前的wordpress规则之上?是的,我也尝试过,奇怪的是,如果我直接调用我的包装器:www.misite.com/home.php,它就可以工作了!如果我添加行
DirectoryIndex home.php
,它将进入一个循环并反复加载音乐播放器。