ILikeTacos
ILikeTacos

Reputation: 18666

How to break redirect loop in htaccess and wordpress

I have a wordpress site and I want to add a music player to it in a way that music is not interrupted, and visitors can browse the website while listening continuously to the music

I added two iframes: The first loads his website, while the other one loads the music player. Then I put both in a wrapper called home.php and added the following rule to .htaccess file:

DirectoryIndex home.php

So the wrapper would load instead of index.php from Wordpress. The code of home.php is as follows:

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

And that's all I've changed.

The complete .htaccess looks like this:

# 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

The problem arises when I go to the website, and home.php loads as the index, and then it enters a redirect loop because loads the music player on and on, and never loads the wordpress site.

Any ideas why is this happening? Is this an .htaccess issue or a wordpress issue? Thanks!

Upvotes: 0

Views: 911

Answers (1)

Jon Lin
Jon Lin

Reputation: 143856

You can try to make it so neither home.php nor audio is being handled by wordpress. You can exclude then like the index.php is being excluded:

# 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

Upvotes: 1

Related Questions