PHP pages other than index.php give a 301 redirect error

16 years 1 month ago #3140 by benmcntsh
Hello,

I have SEF Advance 1.5.7 installed and running great. The only problem is that I have a couple of other php files in the root directory of my website that I need to access, but when SEF Advance is enabled, I get a 301 redirect error and it pushes me to the home page.

For example I have a custom php page that requests an image to be displayed:

www.picturefixerpro.com/upload.php?task=...e=jack_nicholson.jpg

With SEF Advance off, the image is displayed fine. With SEF Advance on, I get a 301 response and I'm pushed to the homepage immediately.

How can I prevent this?

Thanks,
Ben

Please Log in or Create an account to join the conversation.

16 years 1 month ago #3142 by Saka
Requests to existing files should not be forwarded to SEF Advance. Perhaps your .htaccess file is wrong. I suggest you send a mail with access info to your site so I can have a look.

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

16 years 1 month ago #3144 by benmcntsh
Thanks very much for the reply. I started digging in and came up with the following php code that causes the problem. This code was in upload.php, part of an AJAX uploader that someone coded for me.
<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

// CREATE THE APPLICATION
$mainframe =& JFactory::getApplication('site');

// INITIALISE THE APPLICATION
$mainframe->initialise();
JPluginHelper::importPlugin('system');

// trigger the onAfterInitialise events
$mainframe->triggerEvent('onAfterInitialise');

// ROUTE THE APPLICATION
$mainframe->route();
?>

It looks like the $mainframe->route() call is what causes the problem. When running this code from a file (test.php) with SEF Advance on, I get pushed to the home page. With SEF Advance off, I get a blank page that stays at test.php in the address bar.

Can you give me some insight as to what is happening? It is definately something with SEF Advance and unfortunately my php skills are only mediocre. I guess the route() is sending the page to SEF Advance? Can I tell SEF Advance to ignore this page?

Thanks very much.

Please Log in or Create an account to join the conversation.

16 years 1 month ago #3145 by benmcntsh
I fixed the problem temporarily by commenting out the $mainframe->route() line. Do you think that will have any adverse effects?

Please Log in or Create an account to join the conversation.

16 years 1 month ago #3146 by Saka
It's obviously a copy of Joomla's index.php file. If that's just an upload page there should be nothing to route so you are fine with commenting that line out.

Emir Sakic
www.sakic.net

Please Log in or Create an account to join the conversation.

16 years 1 month ago #3147 by benmcntsh
Great. Thanks again for the quick replies and great product.

Please Log in or Create an account to join the conversation.

About us

We provide high quality Joomla components created by a co-founder and original core developer of Joomla. For over a decade, our products have been used by more than 20.000 webmasters around the world.

Stay in touch